<template>
	<div>
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">车牌号:</p>
			</el-col>
			<el-col :span="4">
				<el-input size="small" :maxlength="200" v-model="condition.plateNum" placeholder="请输入车牌号">
				</el-input>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">保险公司:</p>
			</el-col>
			<el-col :span="4">
				<el-input size="small" :maxlength="200" v-model="condition.insuranceCompanyName" placeholder="请输入保险公司">
				</el-input>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">被保险人:</p>
			</el-col>
			<el-col :span="4">
				<el-input size="small" :maxlength="200" v-model="condition.insured" placeholder="请输入被保险人">
				</el-input>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">联系电话:</p>
			</el-col>
			<el-col :span="4">
				<el-input size="small" :maxlength="200" v-model="condition.contactPhone" placeholder="请输入联系电话">
				</el-input>
			</el-col>
			<el-col :span="2" style="padding-left: 0px;text-align: right">
				<el-button type="primary" size="small" v-on:click='companyQuery'>查询</el-button>
			</el-col>
		</el-row>
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right: 10px;">
				<p class="queryLabel">起始日期:</p>
			</el-col>
			<el-col :span="7">
				<el-date-picker size="small" style="width: 150px;" v-model="condition.startDate " type="date" placeholder="开始日期">
				</el-date-picker>
				至
				<el-date-picker size="small" style="width: 150px;" v-model="condition.stopDate" type="date" placeholder="结束日期">
				</el-date-picker>
			</el-col>
			<el-col :span="16" style="text-align: right;margin-left: -10px;">
				<el-button type="primary" size="small" v-on:click='add'>新增</el-button>
				<el-button type="primary" size="small" v-on:click='info'>编辑</el-button>
				<el-button type="primary" size="small" v-on:click='deletee'>删除</el-button>
				<!--				<el-button type="primary" size="small" v-on:click='outOrderfun(multipleSelection[0].qid,multipleSelection[0].id)'>出单</el-button>
--></el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChange">
					<el-table-column type="selection" width="60">
					</el-table-column>
					<el-table-column label="车牌号" prop="plateNum" width="100px">
					</el-table-column>
					<el-table-column label="车龄" align="right" prop="age" width="70px">
					</el-table-column>
					<el-table-column label="车架号" align="right" prop="vin" width="170px">
					</el-table-column>
					<el-table-column label="被保险人" align="right" prop="insured" width="150px">
					</el-table-column>
					<el-table-column label="联系电话" align="right" prop="contactPhone" width="120px">
					</el-table-column>
					<el-table-column label="保险公司" align="right" prop="insuranceCompanyName">
					</el-table-column>
					<el-table-column label="保险起始日期" align="right" prop="insuranceStartDate" width="120px">
					</el-table-column>
					<el-table-column label="单据创建日期" align="right" prop="time" :formatter="createDate" width="120px">
					</el-table-column>
					<el-table-column label="状态" align="right" prop="status" :formatter="statusCov" width="80px">
					</el-table-column>
					<el-table-column label="操作" align="right" width="70px" fixed="right">
						<template scope="scope">
							<el-button type="primary" size="mini" @click.native.prevent="outOrderfun(scope.$index)">出单</el-button>
						</template>
					</el-table-column>
				</el-table>
				<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>
			</el-col>
		</el-row>
		<!--
        	作者：1813180149@qq.com
        	时间：2017-04-27
        	描述：新增报价单
        -->
		<el-dialog title="车辆信息" v-model="comFormShow" size="small">
			<el-row :gutter="24">
				<el-col :span="2" style="margin-right:10px;">
					<p class="queryLabel">查询方式:</p>
				</el-col>
				<el-col :span="6">
					<el-select size="small" v-model="conditions.key" @change="queryTypeSave" placeholder="选择查询方法">
						<el-option v-for="item in moduleCombo" :label="item.label" :value="item.value">
						</el-option>
					</el-select>
				</el-col>
				<el-col :span="2" style="margin-right:10px;">
					<p class="queryLabel">查询内容:</p>
				</el-col>
				<el-col :span="6">
					<el-input size="small" :maxlength="200" style="margin-left:15px;" v-model="conditions.value" placeholder="请输入内容">
					</el-input>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='carQuery'>查询</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-card class="box-card">
						<el-form :model="comFormData" ref="comForm" label-width="100px">
							<el-col :span="12">
								<el-form-item label="车牌号：" prop="plateNum">
									<el-input size="small" :maxlength="200" v-model="comFormData.plateNum" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="车型：" prop="carModel">
									<el-input size="small" :maxlength="200" v-model="comFormData.carModel" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="VIN：" prop="vin">
									<el-input size="small" :maxlength="200" v-model="comFormData.vin" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="车龄：" prop="carAge">
									<el-input size="small" :maxlength="200" v-model="comFormData.carAge" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="被保险人：" prop="insured">
									<el-input size="small" :maxlength="200" v-model="comFormData.insured" readonly placeholder=""></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="联系电话：" prop="contactPhone">
									<el-input size="small" :maxlength="200" v-model="comFormData.contactPhone" readonly placeholder=""></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="投保公司：" prop="insuranceCompany">
									<el-input size="small" :maxlength="200" v-model="comFormData.insuranceCompany" readonly placeholder=""></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="保险到期日：" prop="insuranceEndDate">
									<el-input size="small" :maxlength="200" v-model="comFormData.insuranceEndDate" readonly placeholder=""></el-input>
								</el-form-item>
							</el-col>
						</el-form>
					</el-card>
				</el-col>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="24">
					<el-form ref="comForm" label-width="120px">
						<el-col :span="12">
							<el-form-item label="投保类别：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" v-model="QuotationFrom.paramQuotation.insureType" placeholder="请选择保险类别" clearable>
									<el-option label="新保" value="sb"></el-option>
									<el-option label="续保" value="xb"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="投保起始日：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-date-picker size="small" style="width: 95%;" v-model="QuotationFrom.paramQuotation.insuranceStartDate" format="yyyy-MM-dd" type="date" placeholder="开始时间">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="一级区域：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" v-model="QuotationFrom.paramQuotation.storePareaCode" @change="getStoreAreaCombo" placeholder="请选择一级区域">
									<el-option v-for="item in storePareaCombo" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="二级区域：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" @change="getStoreNameCombo" v-model="QuotationFrom.paramQuotation.storeAreaCode" placeholder="请选择二级区域">
									<el-option v-for="item in storeAreaCombo" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="门店：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" @change="getinsuranceCompany" v-model="QuotationFrom.paramQuotation.storeCode" placeholder="请选择门店">
									<el-option v-for="item in storeNameCombo" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="渠道：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" v-model="QuotationFrom.paramQuotation.storeChanel" placeholder="请选择渠道">
									<el-option label="传统" value="0">
									</el-option>
									<el-option label="店销" value="1">
									</el-option>
									<el-option label="其他" value="2">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="保险公司：" required v-if="QuotationFrom.paramQuotation.carId">
								<el-select size="small" style="width: 100%;" @change="getTemplateShow('1')" v-model="QuotationFrom.paramQuotation.insuranceCompanyId" placeholder="选择保险公司">
									<el-option v-for="item in companyCombo" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-form>
				</el-col>
			</el-row>
			<div slot="footer" class="dialog-footer" v-if="QuotationFrom.paramQuotation.carId">
				<el-button @click="comFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='save' v-loading.fullscreen.lock="fullscreenloading">提 交</el-button>
			</div>
		</el-dialog>

		<!--
        	作者：1813180149@qq.com
        	时间：2017-04-27
        	描述：报价单维护
        -->
		<el-dialog title="报价单维护" v-model="comFormShows" size="large" :before-close="comFormShowsClose">
			<el-row :gutter="24">
				<el-col :span="2" style="margin-right:10px;">
					<p class="queryLabel">投保起始日:</p>
				</el-col>
				<el-col :span="9">
					<el-date-picker size="small" style="width: 100%; margin-left: 4px;" disabled v-model="infoData.insuranceStartDate" format="yyyy-MM-dd" type="date" placeholder="开始时间">
					</el-date-picker>
				</el-col>
				<el-col :span="2" style="margin-right:10px;">
					<p class="queryLabel">投保结束日:</p>
				</el-col>
				<el-col :span="9">
					<el-date-picker size="small" style="width: 100%; margin-left: 4px;" disabled v-model="infoData.insuranceStopDate" format="yyyy-MM-dd" type="date" placeholder="结束时间">
					</el-date-picker>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-card class="box-carda">
						<el-form :model="infoData" ref="comForm" :rules="Rule" label-width="150px">
							<el-col :span="6">
								<!--TODO-->
								<el-form-item label="被保险人：" prop="insured">
									<el-input size="small" :maxlength="200" v-model="infoData.insured">
										<el-select v-model="infoData.source" style="width: 80px;" slot="prepend">
											<el-option label="个人" value="0"></el-option>
											<el-option label="单位" value="1"></el-option>
										</el-select>
									</el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="被保险人证件号：" prop="insuredIdNumber">
									<el-input size="small" :maxlength="200" v-model="infoData.insuredIdNumber"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="被保险人地址：">
									<el-input size="small" :maxlength="200" v-model="infoData.insuredAddress"></el-input>
								</el-form-item>
							</el-col>
							<!--<el-col :span="6">
								<el-form-item label="邮编：" prop="postCode">
									<el-input size="small" :maxlength="200" v-model="infoData.postCode"></el-input>
								</el-form-item>
							</el-col>-->
							<el-col :span="6">
								<el-form-item label="联系人：" prop="contactName">
									<el-input size="small" :maxlength="200" v-model="infoData.contactName"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="联系电话：" prop="contactPhone">
									<el-input size="small" :maxlength="200" v-model="infoData.contactPhone"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="E_mail：" prop="email">
									<el-input size="small" :maxlength="200" v-model="infoData.email"></el-input>
								</el-form-item>
							</el-col>

							<el-col :span="6">
								<el-form-item label="车牌号：" prop="plateNum">
									<el-input size="small" :maxlength="200" v-model="infoData.plateNum" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="车型：" prop="carModel">
									<el-input placeholder="请选择车型" :maxlength="200" size="small" icon="search" v-model="infoData.carModel" :on-icon-click="chooseSearchModel" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="厂牌代码：" prop="label">
									<el-input placeholder="请输入 厂牌代码" size="small" v-model="infoData.label"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="发动机号：" prop="engineNum">
									<el-input size="small" :maxlength="200" v-model="infoData.engineNum"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="车架号：" prop="vin">
									<el-input size="small" :maxlength="200" v-model="infoData.vin" readonly></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="发动机类型：" prop="carType">
									<el-input size="small" :maxlength="200" v-model="infoData.carType"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="排量/功率：" prop="power">
									<el-input size="small" :maxlength="200" v-model="infoData.power"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="载客/载重量：" prop="passengerWeight">
									<el-input size="small" :maxlength="200" v-model="infoData.passengerWeight"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="使用性质：" prop="useProperty">
									<el-input size="small" :maxlength="200" v-model="infoData.useProperty"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="行驶证车主：" prop="driverLicense">
									<el-input size="small" :maxlength="200" v-model="infoData.driverLicense"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="初次登记日期：" prop="firstRecordDate">
									<el-input size="small" v-model="infoData.firstRecordDate" placeholder="例如'2017-01-01'"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="6">
								<el-form-item label="实际价值：" prop="realValue">
									<el-input size="small" :maxlength="200" v-model="infoData.realValue"></el-input>
								</el-form-item>
							</el-col>
						</el-form>
					</el-card>
				</el-col>
			</el-row>
			<el-row>
				<div class="table-d" v-if="templateShow == '1'">
					<table border="1" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;width: 100%;border-collapse: collapse;">
						<tr>
							<td colspan="7">
								<el-col :span="12" style="text-align: left;padding-top: 3px;">
									<b>保险报价单  </b>
								</el-col>
								<el-col :span="3" style="text-align: right;padding-top: 3px;">
									<b>交强险优惠:</b>
								</el-col>
								<el-col :span="3" style="text-align: right;">
									<el-input size="mini" style="width: 100%;" :maxlength="200" type="number" v-model="infoData.coupulsoryDiscount">
										<template slot="append">%</template>
									</el-input>
								</el-col>
								<el-col :span="3" style="text-align: right;padding-top: 3px;">
									<b>商业险优惠:</b>
								</el-col>
								<el-col :span="3" style="text-align: right;">
									<el-input size="mini" style="width: 100%;" :maxlength="200" type="number" v-model="infoData.commercialinsuranceDiscount">
										<template slot="append">%</template>
									</el-input>
								</el-col>
							</td>
						</tr>
						<tr>
							<td style="width:25%;text-align: center;background-color: #55C0F1;color: #333333;"><b>主要投保险种  </b></td>
							<td style="width:15%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保额/限额 </b></td>
							<td style="width:10%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险费  </b></td>
							<td style="width:5%;text-align: center;background-color: #55C0F1;color: #333333;"><b>是否 </b></td>
							<td style="width:10%;text-align: center;background-color: #55C0F1;color: #333333;"><b>不计免赔保费  </b></td>
							<td style="width:25%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险险种</b></td>
							<td style="width:10%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险费</b></td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[2].starts" @change="startChange('2')">车辆损失险</el-checkbox>
							</td>
							<td></td>
							<td rowspan="1"><input v-model="intem[2].price" class='table_input' v-on:blur="sumPrice"></td>
							<td rowspan="1" style="text-align: center;">
								<el-checkbox v-model="intem[3].starts" @change="startChange('3')"></el-checkbox>
							</td>
							<td rowspan="1"><input v-model="intem[3].price" class='table_input' v-on:blur="sumPrice"></td>
							<td>
								<el-checkbox v-model="intem[1].starts" @change="startChange('1')">交强险</el-checkbox>
							</td>
							<td><input v-model="intem[1].price" class='table_input' v-on:blur="sumPrice">
							</td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[4].starts" @change="startChange('4')">第三者责任险</el-checkbox>
							</td>
							<td rowspan="1">
								<el-select v-model="intem[4].limit" @change="quotaChange('4')" size="small">
									<el-option label="5万" value="50000"></el-option>
									<el-option label="10万" value="100000"></el-option>
									<el-option label="15万" value="150000"></el-option>
									<el-option label="20万" value="200000"></el-option>
									<el-option label="30万" value="300000"></el-option>
									<el-option label="50万" value="500000"></el-option>
									<el-option label="100万" value="1000000"></el-option>
									<el-option label="150万" value="1500000"></el-option>
									<el-option label="200万" value="2000000"></el-option>
								</el-select>
							</td>
							<td rowspan="1"><input v-model="intem[4].price" class='table_input' v-on:blur="sumPrice"></td>
							<td rowspan="1" style="text-align: center;">
								<el-checkbox v-model="intem[5].starts" @change="startChange('5')"></el-checkbox>
							</td>
							<td rowspan="1"><input v-model="intem[5].price" class='table_input' v-on:blur="sumPrice"></td>
							<td>
								<el-checkbox v-model="intem[0].starts" style="color: red;" @change="startChange('0')">车船使用税</el-checkbox>
							</td>
							<td><input v-model="intem[0].price" class='table_input' v-on:blur="sumPrice">
							</td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[6].starts" @change="startChange('6')">盗抢险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[6].price" class='table_input' v-on:blur="sumPrice"></td>
							</td>

							<td style="text-align: center;">
								<el-checkbox v-model="intem[7].starts" @change="startChange('7')"></el-checkbox>
							</td>
							<td><input v-model="intem[7].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[8].starts" @change="startChange('8')">车上人员责任险-司机</el-checkbox>
							</td>
							<td><input v-model="intem[8].limit" v-on:blur="quotaChange('8')" style="width: 90%;border-style:none;outline:medium;">万
							</td>
							<td><input v-model="intem[8].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[10].starts" @change="startChange('10')"></el-checkbox>
							</td>
							<td><input v-model="intem[10].price" class='table_input' v-on:blur="sumPrice"></td>
							<td>
								<el-checkbox v-model="intem[22].starts" @change="startChange('22')">润华划痕险</el-checkbox>
							</td>
							<td><input v-model="intem[22].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[9].starts" @change="startChange('9')">车上人员责任险-乘客</el-checkbox>
							</td>
							<td><input v-model="intem[9].limit" v-on:blur="quotaChange('9')" style="width: 90%;border-style:none;outline:medium;">万</td>
							<td><input v-model="intem[9].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[11].starts" @change="startChange('11')"></el-checkbox>
							</td>
							<td><input v-model="intem[11].price" class='table_input' v-on:blur="sumPrice"></td>
							<td>
								<el-checkbox v-model="intem[23].starts" @change="startChange('23')">续保手册</el-checkbox>
							</td>
							<td><input v-model="intem[23].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[12].starts" @change="startChange('12')">车身划痕险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[12].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[13].starts" @change="startChange('13')"></el-checkbox>
							</td>
							<td><input v-model="intem[13].price" class='table_input' v-on:blur="sumPrice"></td>
							<td>
								<el-checkbox v-model="intem[21].starts" @change="startChange('21')">车上货物责任险</el-checkbox>
							</td>
							<td><input v-model="intem[21].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[18].starts" @change="startChange('18')">玻璃单独玻璃险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[18].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
							<td>
								<el-checkbox v-model="intem[24].starts" @change="startChange('24')">驾意险</el-checkbox>
							</td>
							<td><input v-model="intem[24].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[20].starts" @change="startChange('20')">机动车损失保险无法找到第三方特约险</el-checkbox>
							</td>
							<td></td>
							<td rowspan="1"><input v-model="intem[20].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
							<td>
								<el-checkbox v-model="intem[19].starts" @change="startChange('19')">润华玻璃险</el-checkbox>
							</td>
							<td><input v-model="intem[19].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>

							<td>
								<el-checkbox v-model="intem[14].starts" @change="startChange('14')">自燃损失险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[14].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[15].starts" @change="startChange('15')"></el-checkbox>
							</td>
							<td><input v-model="intem[15].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[16].starts" @change="startChange('16')">发动机涉水险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[16].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[17].starts" @change="startChange('17')"></el-checkbox>
							</td>
							<td style="border-bottom-right-radius: 2px;"><input v-model="intem[17].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[26].starts" @change="startChange('26')">新增设备险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[26].price" class='table_input' v-on:blur="sumPrice"></td>
							<td style="text-align: center;">
								<el-checkbox v-model="intem[27].starts" @change="startChange('27')"></el-checkbox>
							</td>
							<td><input v-model="intem[27].price" class='table_input' v-on:blur="sumPrice"></td>
							<td></td>
							<td></td>
						</tr>
					</table>
				</div>
				<div class="table-d" v-if="templateShow == '0'||templateShow == '2'">
					<table border="1" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;width: 100%;border-collapse: collapse;">
						<tr>
							<td colspan="7">
								<el-col :span="12" style="text-align: left;padding-top: 3px;">
									<b>保险报价单  </b>
								</el-col>
								<el-col :span="3" style="text-align: right;padding-top: 3px;">
									<b>交强险优惠:</b>
								</el-col>
								<el-col :span="3" style="text-align: right;">
									<el-input size="mini" style="width: 100%;" :maxlength="200" type="number" v-model="infoData.coupulsoryDiscount">
										<template slot="append">%</template>
									</el-input>
								</el-col>
								<el-col :span="3" style="text-align: right;padding-top: 3px;">
									<b>商业险优惠:</b>
								</el-col>
								<el-col :span="3" style="text-align: right;">
									<el-input size="mini" style="width: 100%;" :maxlength="200" type="number" v-model="infoData.commercialinsuranceDiscount">
										<template slot="append">%</template>
									</el-input>
								</el-col>
							</td>
						</tr>
						<tr>
							<td style="width:25%;text-align: center;background-color: #55C0F1;color: #333333;"><b>主要投保险种  </b></td>
							<td style="width:15%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保额/限额 </b></td>
							<td style="width:10%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险费  </b></td>
							<td style="width:25%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险险种</b></td>
							<td style="width:10%;text-align: center;background-color: #55C0F1;color: #333333;"><b>保险费</b></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[1].starts" @change="startChangeTwo('1')">交强险</el-checkbox>
							</td>
							<td>
							</td>
							<td><input v-model="intem[1].price" class='table_input' v-on:blur="sumPrice">
							</td>
							<td>
								<el-checkbox v-model="intem[14].starts" @change="startChangeTwo('14')">自燃损失险</el-checkbox>
							</td>

							<td><input v-model="intem[14].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[0].starts" style="color: red;" @change="startChangeTwo('0')">车船使用税</el-checkbox>
							</td>
							<td>
							</td>
							<td><input v-model="intem[0].price" class='table_input' v-on:blur="sumPrice">
							</td>
							<td>
								<el-checkbox v-model="intem[21].starts" @change="startChangeTwo('21')">车上货物责任险</el-checkbox>
							</td>
							<td><input v-model="intem[21].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<td rowspan="1">
							<el-checkbox v-model="intem[2].starts" @change="startChangeTwo('2')">车辆损失险</el-checkbox>
						</td>
						<td></td>
						<td rowspan="1"><input v-model="intem[2].price" class='table_input' v-on:blur="sumPrice"></td>
						<td>
							<el-checkbox v-model="intem[16].starts" @change="startChangeTwo('16')">发动机涉水险</el-checkbox>
						</td>

						<td><input v-model="intem[16].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[4].starts" @change="startChangeTwo('4')">第三者责任险</el-checkbox>
							</td>
							<td rowspan="1">
								<el-select v-model="intem[4].limit" size="small">
									<el-option label="5万" value="50000"></el-option>
									<el-option label="10万" value="100000"></el-option>
									<el-option label="15万" value="150000"></el-option>
									<el-option label="20万" value="200000"></el-option>
									<el-option label="30万" value="300000"></el-option>
									<el-option label="50万" value="500000"></el-option>
									<el-option label="100万" value="1000000"></el-option>
									<el-option label="150万" value="1500000"></el-option>
									<el-option label="200万" value="2000000"></el-option>
								</el-select>
							</td>
							<td rowspan="1"><input v-model="intem[4].price" class='table_input' v-on:blur="sumPrice"></td>

							<td>
								<el-checkbox v-model="intem[24].starts" @change="startChangeTwo('24')">驾意险</el-checkbox>
							</td>
							<td><input v-model="intem[24].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[6].starts" @change="startChangeTwo('6')">盗抢险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[6].price" class='table_input' v-on:blur="sumPrice"></td>
							</td>

							<td>
								<el-checkbox v-model="intem[19].starts" @change="startChangeTwo('19')">润华玻璃险</el-checkbox>
							</td>
							<td><input v-model="intem[19].price" class='table_input' v-on:blur="sumPrice"></td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[8].starts" @change="startChangeTwo('8')">车上人员责任险-司机</el-checkbox>
							</td>
							<td><input v-model="intem[8].limit" style="width: 90%;border-style:none;outline:medium;">万
							</td>
							<td><input v-model="intem[8].price" class='table_input' v-on:blur="sumPrice"></td>

							<td>
								<el-checkbox v-model="intem[22].starts" @change="startChangeTwo('22')">润华划痕险</el-checkbox>
							</td>
							<td><input v-model="intem[22].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[9].starts" @change="startChangeTwo('9')">车上人员责任险-乘客</el-checkbox>
							</td>
							<td><input v-model="intem[9].limit" style="width: 90%;border-style:none;outline:medium;">万</td>
							<td><input v-model="intem[9].price" class='table_input' v-on:blur="sumPrice"></td>

							<td>
								<el-checkbox v-model="intem[23].starts" @change="startChangeTwo('23')">续保手册</el-checkbox>
							</td>
							<td><input v-model="intem[23].price" class='table_input' v-on:blur="sumPrice"></td>

						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[18].starts" @change="startChangeTwo('18')">玻璃单独玻璃险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[18].price" class='table_input' v-on:blur="sumPrice"></td>

							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[12].starts" @change="startChangeTwo('12')">车身划痕险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[12].price" class='table_input' v-on:blur="sumPrice"></td>

							<td></td>
							<td></td>
						</tr>
						<tr>
							<td rowspan="1">
								<el-checkbox v-model="intem[20].starts" @change="startChangeTwo('20')">机动车损失保险无法找到第三方特约险</el-checkbox>
							</td>
							<td></td>
							<td rowspan="1"><input v-model="intem[20].price" class='table_input' v-on:blur="sumPrice"></td>

							<td></td>
							<td></td>
						</tr>
						<tr v-if="templateShow != '2'">
							<td>
								<el-checkbox v-model="intem[25].starts" @change="startChangeTwo('25')">不计免赔</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[25].price" class='table_input' v-on:blur="sumPrice"></td>

							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>
								<el-checkbox v-model="intem[26].starts" @change="startChangeTwo('26')">新增设备险</el-checkbox>
							</td>
							<td></td>
							<td><input v-model="intem[26].price" class='table_input' v-on:blur="sumPrice"></td>

							<td></td>
							<td></td>
						</tr>
					</table>
				</div>
			</el-row>
			<br>
			<el-row :gutter="24">
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">交强险价格:</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">{{jqxbj}}￥</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">车船税价格:</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">{{ccsjg}}￥</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">商业险价格:</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">{{syxbj}}￥</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">合计:</strong>
				</el-col>
				<el-col :span="2">
					<strong style="font-size: 15px;padding-top: 0px;">{{sum}}￥</strong>
				</el-col>
				<br><br>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='comFormShowsClose'>关闭窗口</el-button>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='qqClick'>报价请求单</el-button>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='xyClick'>生成短信模板</el-button>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='comFormShowsSure'>保存</el-button>
				</el-col>
				<el-col :span="4" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='orderClick' v-loading.fullscreen.lock="fullscreenloading">保险出单</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="赠品选择窗" v-model="presentShow" size="small">
			<el-row :gutter="24">
				<el-col :span="3" style="margin-right:10px;">
					<p class="queryLabel">活动名称:</p>
				</el-col>
				<el-col :span="10">
					<el-select size="small" placeholder="市场活动" filterable v-model="presentData.activityId">
						<el-option :label="item.name" :value="item.id" v-for="item in activities">
						</el-option>
					</el-select>
				</el-col>
				<el-col :span="2">
					<el-button type="primary" size="small" @click="queryCoupon">查询</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-table :data="presentDataList" height="350" border>
					<el-table-column prop="name" label="所属活动">
					</el-table-column>
					<el-table-column label="优惠券号" prop="num">
					</el-table-column>
					<el-table-column label="有效期" prop="youxiaoqi" :formatter="timeFormates">
					</el-table-column>
					<el-table-column label="使用状态" :formatter="levelCov">
					</el-table-column>
					<el-table-column label="操作" v-if="containSure" width="100px">
						<template scope="scope">
							<el-button size="small" type="primary" @click="selectCoupon(scope.$index, scope.row)">添加</el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-row>
		</el-dialog>
		<el-dialog title="保险出单" v-model="orderShow" size="small" :before-close="outPresentDelete">
			<el-row :gutter="24">
				<el-col :span="24">
					<el-form :model="orderFromData" label-width="150px" ref="bxOrderForms" :rules="bxOrderRule">
						<el-row :gutter="24">
							<el-col :span="12">
								<el-form-item label="出单日期：" prop="outOrderDate">
									<el-date-picker size="small" style="width: 100%;" v-model="orderFromData.outOrderDate" type="date" placeholder="开始时间" @change="outDateChange">
									</el-date-picker>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="交款人：" prop="payPeople">
									<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.payPeople"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="支付方式：" prop="payType">
									<el-select size="small" style="width: 105%;" v-model="orderFromData.payType" placeholder="选择方式">
										<el-option label="现金" value="1">
										</el-option>
										<el-option label="刷卡" value="2">
										</el-option>
										<el-option label="微信" value="3">
										</el-option>
										<el-option label="支付宝" value="4">
										</el-option>
									</el-select>
								</el-form-item>
							</el-col>
							<el-col :span="12">
								<el-form-item label="支付账号：" prop="payNum">
									<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.payNum"></el-input>
								</el-form-item>
							</el-col>
						</el-row>
						<el-row :gutter="24" v-if="syItemsShow">
							<el-card class="box-card">
								<div slot="header" class="clearfix">
									<strong style="font-size: 15px;">商业险：</strong>
								</div>
								<div>
									<el-col :span="12">
										<el-form-item label="商业险起始日期：" v-if="syItemsShow" prop="commercialinsuranceStartDate" required>
											<el-date-picker size="small" @change="dateChange" disabled style="width: 100%;" v-model="orderFromData.commercialinsuranceStartDate" format="yyyy-MM-dd" type="date" placeholder="开始时间">
											</el-date-picker>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="商业险结束日期：" v-if="syItemsShow" prop="commercialinsuranceStopDate" required>
											<el-date-picker size="small" style="width: 100%; " disabled v-model="orderFromData.commercialinsuranceStopDate" type="date" placeholder="结束时间">
											</el-date-picker>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="商业险合同号：" v-if="syItemsShow" prop="commercialinsuranceNum">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.commercialinsuranceNum"></el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="商业险协议费率：" v-if="!orderFromData.isCommissionSyTemp&&syItemsShow" required>
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.commissionSy" readonly>
												<template slot="append">%</template>
											</el-input>
										</el-form-item>
									</el-col>

									<el-col :span="12">
										<el-form-item prop="isCommissionSyTemp" v-if="syItemsShow">
											<el-checkbox label="启用商业险临时费率" name="type" v-model="orderFromData.isCommissionSyTemp">
												<template slot="append">%</template>
											</el-checkbox>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="商业险临时费率：" v-if="orderFromData.isCommissionSyTemp&&syItemsShow" prop="commissionSyTemp" required>
											<el-input size="small" style="width:100%" v-model="orderFromData.commissionSyTemp" type="number">
												<template slot="append">%</template>
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="佣金说明：" v-if="orderFromData.isCommissionSyTemp&&syItemsShow" prop="commissionSyExp">
											<el-input size="small" :maxlength="200" style="width:100%" v-model="orderFromData.commissionSyExp"></el-input>
										</el-form-item>
									</el-col>
								</div>
							</el-card>
						</el-row>
						<el-row :gutter="24" v-if="jqItemsShow">
							<el-card class="box-card">
								<div slot="header" class="clearfix">
									<strong style="font-size: 15px;">交强险：</strong>
								</div>
								<div>
									<el-col :span="12">
										<el-form-item label="交强险起始日期：" v-if="jqItemsShow" prop="compulsoryStartDate" required>
											<el-date-picker size="small" @change="dateChanges" disabled style="width: 100%;" v-model="orderFromData.compulsoryStartDate" type="date" placeholder="开始时间">
											</el-date-picker>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="交强险结束日期：" v-if="jqItemsShow" prop="compulsoryStopDate" required>
											<el-date-picker size="small" style="width: 100%; " disabled v-model="orderFromData.compulsoryStopDate" type="date" placeholder="结束时间">
											</el-date-picker>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="交强险合同号：" v-if="jqItemsShow" prop="compulsoryNum">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.compulsoryNum"></el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="交强险协议费率：" v-if="!orderFromData.isCommissionJqTemp&&jqItemsShow">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.commissionJq" readonly>
												<template slot="append">%</template>
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item prop="isCommissionJqTemp" v-if="jqItemsShow">
											<el-checkbox label="启用交强险临时费率 " name="type" v-model="orderFromData.isCommissionJqTemp">
												<template slot="append">%</template>
											</el-checkbox>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="交强险临时费率：" v-if="orderFromData.isCommissionJqTemp&& jqItemsShow" prop="commissionJqTemp">
											<el-input size="small" style="width:100%" v-model="orderFromData.commissionJqTemp" type="number">
												<template slot="append">%</template>
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="交强险佣金说明：" v-if="orderFromData.isCommissionJqTemp&&jqItemsShow" prop="commissionJqExp">
											<el-input size="small" :maxlength="200" style="width:100%" v-model="orderFromData.commissionJqExp"></el-input>
										</el-form-item>
									</el-col>
								</div>
							</el-card>
						</el-row>
						<el-row :gutter="24">
							<el-card class="box-card">
								<div slot="header" class="clearfix">
									<strong style="font-size: 15px;">店端行为：</strong>
								</div>
								<div>
									<el-col :span="12">
										<el-form-item label="推荐人：">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.refereeName">
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="店端加投金额：">
											<el-input size="small" :maxlength="200" @change="addChangeFunction" style="width: 100%;" v-model="orderFromData.addCommissionPrice" type="number">
												<template slot="append">元</template>
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="店端抵现金额：">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.discount" type="number">
												<template slot="append">元</template>
											</el-input>
										</el-form-item>
									</el-col>
								</div>
							</el-card>
						</el-row>
						<el-row :gutter="24">
							<el-card class="box-card" style="height: 450px;">
								<div slot="header" class="clearfix">
									<strong style="font-size: 15px;">其他信息：</strong>
								</div>
								<div>
									<el-col :span="12">
										<el-form-item label="返现金额：" prop="backPrice">
											<el-input size="small" :maxlength="200" style="width: 100%;" type="number" v-model="orderFromData.backPrice">
												<template slot="append">元</template>
											</el-input>
										</el-form-item>
									</el-col>
									<el-col :span="12" style="text-align: right;">
										<el-form-item label="" prop="">
											<template v-if="jqItemsShow&&!syItemsShow" style="text-align: left;">
												<el-switch v-model="continuous" size="small" on-color="#13ce66" off-color="#ff4949" on-text="是" off-text="否" on-value="true" off-value="false">联保</el-switch>
												<span style="font-size: 14px;font-weight: 600;">&nbsp;联保&nbsp;&nbsp;</span>
											</template>
											<el-button size="small" type="primary" @click="persentShow=true">查看赠品信息</el-button>

										</el-form-item>

									</el-col>
									<el-col :span="12">
										<el-form-item label="销售专员：" prop="insuranceCommissionerId">
											<el-select size="small" v-model="orderFromData.insuranceCommissionerId" filterable placeholder="选择人员">
												<el-option v-for="item in salePeopleCombo" :label="item.uName" :value="item.id">
												</el-option>
											</el-select>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="基盘类别：" prop="baseType" required>
											<el-select size="small" style="width: 100%;" v-model="orderFromData.baseType" placeholder="选择项目">
												<el-option v-for="item in insTypeConvertData" :label="item.label" :value="item.id">
												</el-option>
											</el-select>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="新车属性：" prop="carProperty" required>
											<el-select size="small" style="width: 100%;" v-model="orderFromData.carProperty" placeholder="选择新车属性">
												<el-option label="新车金融" value="xcjr">
												</el-option>
												<el-option label="新车全款" value="xcqk">
												</el-option>
											</el-select>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="车辆销售属性：" prop="salesProperty" required>
											<el-select size="small" style="width: 100%;" v-model="orderFromData.salesProperty" placeholder="选择销售属性">
												<el-option label="本地销" value="bdx">
												</el-option>
												<el-option label="外地销" value="wdx">
												</el-option>
											</el-select>
										</el-form-item>
									</el-col>
									<el-col :span="24">
										<el-form-item label="优惠信息：" prop="discountInfo">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.discountInfo" type="textarea"></el-input>
										</el-form-item>
									</el-col>
									<el-col :span="24">
										<el-form-item label="备注：" prop="remark">
											<el-input size="small" :maxlength="200" style="width: 100%;" v-model="orderFromData.remark" type="textarea"></el-input>
										</el-form-item>
									</el-col>
								</div>
							</el-card>
						</el-row>
					</el-form>
				</el-col>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="24" style="padding-left: 0px;text-align: right">
					<el-button v-on:click='outPresentDelete'>取消</el-button>
					<el-button type="primary" v-on:click='saveOrder' v-loading.fullscreen.lock="fullscreenloading" v-if="containSure">确认</el-button>

				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="赠品信息" size="small" v-model="persentShow">
			<el-row :span="24">
				<el-col :span="12">
					<strong>赠品信息</strong>
				</el-col>
				<el-col :span="12" style="text-align: right;">
					<el-button type="info" size="small" @click="addPresent" v-if="containSure">增加</el-button>
				</el-col>
			</el-row>
			<el-row :span="24">
				<el-table :data="pretableData.dataList" height="200" border>
					<el-table-column prop="name" label="活动名称">
					</el-table-column>
					<el-table-column label="优惠券号" prop="num">
					</el-table-column>
					<el-table-column label="操作" v-if="containSure" width="100px">
						<template scope="scope">
							<el-button size="small" type="danger" @click="presentDelete(scope.$index, scope.row)">删除</el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-row>
		</el-dialog>
		<el-dialog title="报价请求单" v-model="qqShow" size="tiny">
			<el-row :gutter="24">
				<el-col :span="24">
					<el-form :model="qqFromData" label-width="0px">
						<el-col :span="24">
							<el-form-item label="" prop="qqText">
								<el-input size="small" :maxlength="200" v-model="qqFromData.qqText" :autosize="{ minRows: 5,maxRows: 10}" type="textarea"></el-input>
							</el-form-item>
						</el-col>
					</el-form>
				</el-col>
			</el-row>
			<el-row :gutter="24">

				<el-col :span="10" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click='copyQQ'>复制</el-button>
				</el-col>
				<el-col :span="8" style="padding-left: 0px;text-align: right">
					<el-button v-on:click='qqShow=false'>关闭</el-button>
				</el-col>

			</el-row>
		</el-dialog>
		<el-dialog title="报价响应单" v-model="xyShow" size="tiny">
			<el-row :gutter="24">
				<el-col :span="24">
					<el-form :model="xyFromData" label-width="0px">
						<el-col :span="24">
							<el-form-item label="" prop="xyText">
								<el-input size="small" :maxlength="200" v-model="xyFromData.xyText" :autosize="{ minRows: 5,maxRows: 10}" type="textarea"></el-input>
							</el-form-item>
						</el-col>
					</el-form>
				</el-col>
			</el-row>
			<el-row :gutter="24">

				<el-col :span="10" style="padding-left: 0px;text-align: right">
					<el-button type="primary" v-on:click=''>复制</el-button>
				</el-col>
				<el-col :span="8" style="padding-left: 0px;text-align: right">
					<el-button v-on:click='xyShow=false'>关闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="价格确认" v-model="sureShow" size="tiny">
			<el-row :gutter="24">
				<el-col :span="24">
					<el-form :model="xyFromData" label-width="100px">
						<el-col :span="24">
							<el-form-item label="商业险价格:" prop="">
								<span>{{syxbj}} 元</span>
							</el-form-item>
						</el-col>
						<el-col :span="24">
							<el-form-item label="交强险价格:" prop="">
								<span>{{jqxbj}} 元</span>
							</el-form-item>
						</el-col>
						<el-col :span="24">
							<el-form-item label="车船税价格:" prop="">
								<span>{{ccsjg}} 元</span>
							</el-form-item>
						</el-col>

						<el-col :span="24">
							<el-form-item label="合计:" prop="">
								<span>{{sum}} 元</span>
							</el-form-item>
						</el-col>
					</el-form>
				</el-col>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="24" style="padding-left: 0px;text-align: right;margin-bottom: 20px;">
					<el-button v-on:click='sureShow=false'>取消</el-button>
					<el-button type="primary" v-on:click='saveEdit' v-loading.fullscreen.lock="fullscreenloading">确认</el-button>

				</el-col>
			</el-row>
		</el-dialog>
		<!--
        	作者：1040117458@qq.com
        	时间：2017-06-24
        	描述：报价超出预警
        -->
		<el-dialog title="报价预警" v-model="yujingShow" size="tiny">
			<el-row :gutter="24">
				<el-col :span="24">
					<span>{{yujingMsg}}</span>
				</el-col>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="24" style="padding-left: 0px;text-align: right;margin-bottom: 20px;">
					<el-button v-on:click='yujingShow=false'>取消</el-button>
					<el-button type="primary" v-on:click='yujingSave'>确认</el-button>

				</el-col>
			</el-row>
		</el-dialog>
		<el-dialog title="选择车型" v-model="searchCarShow" size="small">
			<el-row :gutter="24">
				<el-col :span="11" style="margin-left:5px;">
				</el-col>
				<el-col :span="24" style="margin-left:5px;">
					<div style="height: 3em;"></div>
				</el-col>
				<el-col :span="24" style="margin-left:5px; height: 250px;overflow: scroll;">
					<el-tree :data="SearchTreeData" :filter-node-method="filterNode" :highlight-current=true :props="defaultProps" accordion @node-click="searchNodeClick" :auto-expand-parent=false node-key="id"></el-tree>
				</el-col>
			</el-row>

			<div slot="footer" class="dialog-footer">
				<el-button @click="searchCarShow = false">取 消</el-button>
				<el-button type="primary" @click="serchSaveCar">提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="客户档案维护" v-model="customerShow" size="small">
			<el-form :model="customerData" ref="customer" :rules="customerRule" label-width="150px">
				<el-row :gutter="24">
					<el-col :span="12">
						<el-form-item label="被保险人：" prop="insured">
							<el-input size="small" :maxlength="200" @change="peopleChange" v-model="customerData.insured">
								<el-select v-model="customerData.source" style="width: 80px;" slot="prepend">
									<el-option label="个人" value="0"></el-option>
									<el-option label="单位" value="1"></el-option>
								</el-select>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="被保险人证件号：" prop="insuredIdNumber">
							<el-input size="small" :maxlength="200" v-model="customerData.insuredIdNumber"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="联系电话：" prop="contactPhone">
							<el-input size="small" :maxlength="200" v-model="customerData.contactPhone"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="车架号：" prop="vin">
							<el-input size="small" :maxlength="200" v-model="customerData.vin"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="车型：" prop="carModel">
							<!--<el-input size="small" v-model="customerData.carModel"></el-input>-->
							<el-input placeholder="请选择车型" :maxlength="200" size="small" icon="search" v-model="customerData.carModel" :on-icon-click="handleIconClick">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="初次登记日期：" required>
							<!--<el-input size="small" v-model="customerData.firstRecordDates"></el-input>-->
							<el-date-picker size="small" style="width: 95%;" v-model="firstRecordDates" format="yyyy-MM-dd" type="date" placeholder="初次登记日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="厂牌代码：">
							<el-input size="small" :maxlength="200" v-model="customerData.label"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="被保险人地址：">
							<el-input size="small" :maxlength="200" v-model="customerData.insuredAddress"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="邮编：">
							<el-input size="small" :maxlength="200" v-model="customerData.postCode"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="联系人：">
							<el-input size="small" :maxlength="200" v-model="customerData.contactName"></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="E_mail：">
							<el-input size="small" :maxlength="200" v-model="customerData.email"></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="车牌号：">
							<el-input size="small" :maxlength="200" v-model="customerData.plateNum"></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="发动机号：">
							<el-input size="small" :maxlength="200" v-model="customerData.engineNum"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="新车属性：">
							<el-select size="small" style="width: 100%;" v-model="customerData.carProperty" placeholder="选择新车属性">
								<el-option label="新车金融" value="xcjr">
								</el-option>
								<el-option label="新车全款" value="xcqk">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="销售属性：">
							<el-select size="small" style="width: 100%;" v-model="customerData.salesProperty" placeholder="选择销售属性">
								<el-option label="本地销" value="bdx">
								</el-option>
								<el-option label="外地销" value="wdx">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="发动机类型：">
							<el-input size="small" :maxlength="200" v-model="customerData.carType"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="排量/功率：">
							<el-input size="small" :maxlength="200" v-model="customerData.power"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="载客/载重量：">
							<el-input size="small" :maxlength="200" v-model="customerData.passengerWeight"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="使用性质：">
							<el-input size="small" :maxlength="200" v-model="customerData.useProperty"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="行驶证车主：">
							<el-input size="small" :maxlength="200" v-model="customerData.driverLicense"></el-input>
						</el-form-item>
					</el-col>

					<el-col :span="12">
						<el-form-item label="实际价值：">
							<el-input size="small" :maxlength="200" v-model="customerData.realValue"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="customerShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveCustomer'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="提示" v-model="auditShow" size="mini">
			<div style="text-align: center;">
				<strong style="font-size: 16px;">是否载入保险项目？</strong>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="danger" v-on:click='auditShow = false'>不载入</el-button>
				<el-button type="primary" v-on:click='lastMessage()'>载入保险单</el-button>
				<el-button type="primary" v-on:click='lastMessage(insurance)'>载入报价单</el-button>
			</div>
		</el-dialog>
	</div>
</template>
<script>
	import moment from 'moment'
	export default {
		data: function() {
			return {
				storePareaCombo: [],
				storeAreaCombo: [],
				storeChanelCombo: [],
				storeNameCombo: [],
				//保险单销售人员
				salePeopleCombo: [],
				//优惠券列表
				presentDataList: [],
				//是否为联保
				continuous: 'false',
				//保险项目模板显示
				templateShow: "",
				//保险出单按钮等待框
				fullscreenloading: false,
				auditShow: false,
				syItemsShow: false,
				jqItemsShow: false,
				showStart: false,
				dictTreeSearchValue: "",
				//新增客户档案
				customerShow: false,
				firstRecordDates: "",
				//客户档案
				customerData: {
					source: '', //被保险人类型0个人1单位
					carProperty: '', //新车属性
					salesProperty: '', //销售属性
					insured: "",
					compulsoryTotal: "",
					insuredIdNumber: "",
					carType: "",
					useProperty: "",
					commercialinsuranceTotal: "",
					driverLicense: "",
					vin: "",
					id: "",
					ower: "",
					email: "",
					passengerWeight: "",
					contactName: "",
					engineNum: "",
					updateUser: "",
					updateTime: "",
					firstRecordDate: null,
					plateNum: "",
					insuranceStopDate: '',
					carAge: "",
					realValue: "",
					companyId: "",
					createTime: "",
					createUser: "",
					postCode: "",
					insuredAddress: "",
					contactPhone: "",
					insuranceStartDate: "",
					carModel: "",
					carLevel: '',
					carValue: '',
					power: "",
					label: '', //厂牌代码
				},
				//初始化客户档案
				customerEmptyData: {
					source: '0', //被保险人类型0个人1单位
					carProperty: '', //新车属性
					salesProperty: '', //销售属性
					insured: "",
					compulsoryTotal: "",
					insuredIdNumber: "",
					carType: "",
					useProperty: "",
					commercialinsuranceTotal: "",
					driverLicense: "",
					vin: "",
					id: "",
					ower: "",
					email: "",
					passengerWeight: "",
					contactName: "",
					engineNum: "",
					updateUser: "",
					updateTime: "",
					firstRecordDate: null,
					plateNum: "",
					insuranceStopDate: "",
					carAge: "",
					realValue: "",
					companyId: "",
					createTime: "",
					createUser: "",
					postCode: "",
					insuredAddress: "",
					contactPhone: "",
					insuranceStartDate: "",
					carModel: "",
					carLevel: '',
					carValue: '',
					power: "",
					label: '', //厂牌代码
				},
				//客户档案校验规则
				//校验规则
				customerRule: {
					insured: [{
						required: true,
						message: '请输入被保险人',
						trigger: 'blur'
					}],
					insuredIdNumber: [{
						required: true,
						message: '请输入被保险人证件号',
						trigger: 'blur'
					}],
					contactPhone: [{
						required: true,
						message: '请输入联系电话',
						trigger: 'blur'
					}],
					vin: [{
						required: true,
						message: '请输入车架号',
						trigger: 'blur'
					}],
					carModel: [{
						required: true,
						message: '请输入车型',
						trigger: 'blur'
					}],
				},
				//赠品信息
				persentShow: false,
				//报价预警界面
				yujingShow: false,
				//报价预警信息存储
				yujingMsg: '',
				checkedJQ: false,
				searchCarShow: false,
				//搜索的车型数据
				SearchTreeData: [],
				//树型数据配置
				defaultProps: {
					children: 'child',
					label: 'label',
				},
				searhcarType: '',
				searchdatavale: '',
				searchdatalabel: '',
				intem: [{
					name: "交强险-车船使用税",
					type: 0,
					limit: "",
					price: "",
					id: 0,
					starts: false,
				}, {
					name: "交强险-保险费",
					type: 1,
					limit: "",
					price: "",
					id: 1,
					starts: false,
				}, {
					name: "车辆损失险",
					type: 1,
					limit: "",
					price: "",
					id: 2,
					starts: false,
				}, {
					name: "车辆损失险不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 3,
					starts: false,
				}, {
					name: "第三者责任险",
					type: 1,
					limit: "",
					price: "",
					id: 4,
					starts: false,
				}, {
					name: "第三者责任险不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 5,
					starts: false,
				}, {
					name: "盗抢险",
					type: 1,
					limit: "",
					price: "",
					id: 6,
					starts: false,
				}, {
					name: "盗抢险不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 7,
					starts: false,
				}, {
					name: "车上人员责任险-司机",
					type: 1,
					limit: "",
					price: "",
					id: 8,
					starts: false,
				}, {
					name: "车上人员责任险-乘客",
					type: 1,
					limit: "",
					price: "",
					id: 9,
					starts: false,
				}, {
					name: "车上人员责任险-司机-不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 10,
					starts: false,
				}, {
					name: "车上人员责任险-乘客-不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 11,
					starts: false,
				}, {
					name: "车身划痕险",
					type: 1,
					limit: "",
					price: "",
					id: 12,
					starts: false,
				}, {
					name: "车身划痕险不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 13,
					starts: false,
				}, {
					name: "自燃损失险",
					type: 1,
					limit: "",
					price: "",
					id: 14,
					starts: false,
				}, {
					name: "自燃损失险不计免赔",
					type: 1,
					limit: "",
					price: "",
					id: 15,
					starts: false,
				}, {
					name: "发动机涉水险",
					type: 1,
					limit: "",
					price: "",
					id: 16,
					starts: false,
				}, {
					name: "发动机涉水险不计免赔",
					type: 0,
					limit: "",
					price: "",
					id: 17,
					starts: false,
				}, {
					name: "玻璃单独玻璃险",
					type: 0,
					limit: "",
					price: "",
					id: 18,
					starts: false,
				}, {
					name: "润华玻璃险",
					type: 0,
					limit: "",
					price: "",
					id: 19,
					starts: false,
				}, {
					name: "机动车损失保险无法找到第三方特约险",
					type: 0,
					limit: "",
					price: "",
					id: 20,
					starts: false,
				}, {
					name: "车上货物责任险",
					type: 0,
					limit: "",
					price: "",
					id: 21,
					starts: false,
				}, {
					name: "润华划痕险",
					type: 0,
					limit: "",
					price: "",
					id: 22,
					starts: false,
				}, {
					name: "续保手册",
					type: 0,
					limit: "",
					price: "",
					id: 23,
					starts: false,
				}, {
					name: "驾意险",
					type: 0,
					limit: "",
					price: "",
					id: 24,
					starts: false,
				}, {
					name: "不计免赔",
					type: 0,
					limit: "",
					price: "",
					id: 25,
					starts: false,
				}, {
					name: "新增设备险",
					type: 0,
					limit: "",
					price: "",
					id: 26,
					starts: false,
				}, {
					name: "新增设备险不计免赔",
					type: 0,
					limit: "",
					price: "",
					id: 27,
					starts: false,
				}],
				checkedJQ: false,
				insPrice: 0,
				message: "",
				//保单sa本人
				checked: true,
				//获取基盘下拉
				insTypeConvertData: [],
				qqFromData: {
					qqText: ""
				},
				xyFromData: {
					xyText: ""
				},
				//报价请求单
				qqShow: false,
				//报价响应单
				xyShow: false,
				//价格确认弹框
				sureShow: false,
				//保险出单的确认按钮
				containSure: true,
				//市场活动查询数据
				presentData: {
					activityId: '',
					nums: '',
					carId: ''
				},
				pretableData: {
					dataList: []
				},
				activities: [], //查出来的市场活动
				//保存之后查出的出单数据，包括sy和jq 
				outOrder: {},
				//出单页面的实体
				orderFromData: {
					discount: '', //店端抵现金额
					addCommission: '', //店端加投费率
					addCommissionPrice: '', //店端加投金额
					insuranceCommissionerId: '',
					commissionSyId: '',
					commissionJqId: '',
					companyId: "",
					carId: "",
					insuranceCompanyId: "",
					insured: "",
					contactPhone: "",
					outOrderDate: "",
					payType: "2", //支付方式
					payPeople: "",
					payNum: "", //支付账号
					commercialinsuranceNum: "",
					commercialinsuranceStartDate: "", //商业
					commercialinsuranceStopDate: "",
					commercialinsurancePrice: "",
					commercialinsuranceBackPrice: "",
					commissionSy: '', //商业险佣金
					commissionSyTemp: '', //商业险临时佣金
					isCommissionSyTemp: false, //是否启用商业险
					commissionSyExp: '', //商业险佣金说明
					compulsoryNum: "", //交强险合同号
					compulsoryStartDate: "", //交强
					compulsoryStopDate: "",
					compulsoryPrice: "",
					backPrice: "0",
					commissionJq: '', //交强险佣金
					commissionJqTemp: '', //交强险临时佣金
					isCommissionJqTemp: false, //是否启用交强险
					commissionJqExp: '', //交强险佣金说明
					backType: "",
					backDate: "",
					quotationId: "",
					//					commissionRate: "",
					commission: "",
					insuranceCommissionerName: "",
					baseType: "",
					discountInfo: "",
					remark: "",
					carProperty: '', //新车属性
					salesProperty: '', //销售属性
					continuous: '', //是否联保
					refereeName: '', //推荐人
				},
				//出单页面的实体清空
				emptyOrderFromData: {
					discount: '', //店端抵现金额
					addCommission: '', //店端加投费率
					addCommissionPrice: '', //店端加投金额
					insuranceCommissionerId: '',
					commissionSyId: '',
					commissionJqId: '',
					companyId: "",
					carId: "",
					insuranceCompanyId: "",
					insured: "",
					contactPhone: "",
					outOrderDate: "",
					payType: "2",
					payPeople: "",
					payNum: "",
					commercialinsuranceNum: "",
					commercialinsuranceStartDate: "",
					commercialinsuranceStopDate: "",
					commercialinsurancePrice: "",
					commercialinsuranceBackPrice: "",
					compulsoryNum: "",
					compulsoryStartDate: "",
					compulsoryStopDate: "",
					compulsoryPrice: "",
					backPrice: "0",
					backType: "",
					backDate: "",
					quotationId: "",
					//					commissionRate: "",
					commission: "",
					insuranceCommissionerName: "",
					baseType: "",
					discountInfo: "",
					remark: "",
					carProperty: '', //新车属性
					salesProperty: '', //销售属性
					continuous: '', //是否联保
					refereeName: '', //推荐人
				},

				//出单页面
				orderShow: false,
				//保险项目
				itemShow: false,
				//赠品选择窗
				presentShow: false,
				intmFromData: {
					itemId: "",
					itemPrice: "",
					quotationId: "",
					type: ""
				},
				emptyintmFromData: {
					itemId: "",
					itemPrice: "",
					quotationId: "",
					type: ""
				},
				jqxbj: "",
				syxbj: "",
				ccsjg: '',
				heji: '',
				sum: '',
				insurance: '', //客户档案还是车主档案
				QuotationFrom: {
					paramQuotation: {
						carId: "", //车辆ID
						carAge: '', //车龄
						insuranceCompanyId: "", //保险公司ID
						contactPeople: "", //联系人
						contactPhone: "", //联系电话
						insuranceStartDate: "", //保险起始日期
						insuranceStopDate: "", //保险终止日期
						ompulsoryTotal: "", //交强险总价
						commercialinsuranceTotal: "", //商业险总价
						remark: "", //备注
						insureType: '', //投保类别
						storeChanel: '', //渠道
						storeArea: '', //二级区域
						storeParea: '', //一级区域
						storeName: '', //门店
						storeAreaCode: '', //二级区域
						storePareaCode: '', //一级区域
						storeCode: '', //门店
						commercialinsuranceDiscount: '',
						coupulsoryDiscount: '',
					},
					insurance: ''
				},
				emptyQuotationFrom: {
					paramQuotation: {
						carId: "", //车辆ID
						carAge: '', //车龄
						insuranceCompanyId: "", //保险公司ID
						contactPeople: "", //联系人
						contactPhone: "", //联系电话
						insuranceStartDate: "", //保险起始日期
						insuranceStopDate: "", //保险终止日期
						ompulsoryTotal: "", //交强险总价
						commercialinsuranceTotal: "", //商业险总价
						remark: "", //备注
						insureType: '', //投保类别
						storeChanel: '', //渠道
						storeArea: '', //二级区域
						storeParea: '', //一级区域
						storeName: '', //门店
						storeAreaCode: '', //二级区域
						storePareaCode: '', //一级区域
						storeCode: '', //门店
						commercialinsuranceDiscount: '', //商业险优惠
						coupulsoryDiscount: '', //交强险优惠
					},
					insurance: ''
				},
				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},
				//已选择jq交强
				tableDatajq: {
					total: 0,
					dataList: []
				},
				//已选择jq交强
				tableDatasy: {
					total: 0,
					dataList: []
				},
				//佣金数据
				//分组数据
				tableDatas: {
					total: 0,
					dataList: []
				},
				condition: {
					plateNum: "",
					insuranceCompanyName: '',
					insured: '',
					contactPhone: '',
					startDate: "",
					stopDate: "",

				},
				//选中的对象
				checkData: {},
				//新增时的车辆查询条件
				conditions: {
					key: "0",
					value: ""
				},
				comFormShow: false,
				comFormShows: false,
				moduleCombo: [{
					label: '车牌号',
					value: '0'
				}, {
					label: 'VIN',
					value: '1'
				}],
				companyCombo: [],
				//校验规则
				Rule: { //TODO
					insuredIdNumber: [{
						required: true,
						message: '请输入被保险人证件号',
						trigger: 'blur'
					}],
					insured: [{
						required: true,
						message: '请输入被保险人',
						trigger: 'blur'
					}],
					//					insuredAddress: [{
					//						required: true,
					//						message: '请输入被保险人地址',
					//						trigger: 'blur'
					//					}],
					postCode: [{
						required: true,
						message: '请输入邮编',
						trigger: 'blur'
					}],
					contactName: [{
						required: true,
						message: '请输入联系人',
						trigger: 'blur'
					}],
					contactPhone: [{
						required: true,
						message: '请输入联系电话',
						trigger: 'blur'
					}],
					//					email: [{
					//						required: true,
					//						message: '请输入email',
					//						trigger: 'blur'
					//					}],
					carModel: [{
						required: true,
						message: '请选择车型',
						trigger: 'blur'
					}],
					//					engineNum: [{
					//						required: true,
					//						message: '请输入发动机号',
					//						trigger: 'blur'
					//					}],
					driverLicense: [{
						required: true,
						message: '请输入行驶证车主',
						trigger: 'blur'
					}],
					firstRecordDate: [{
						required: true,
						message: '请选择初次登记日期',
						trigger: 'blur'
					}],

				},
				//校验规则
				Rules: {},
				infoData: { //点击设置进来查出的数据
					source: '', //被保险人类型0个人1单位
					label: '',
					insured: "",
					compulsoryTotal: "",
					insuredIdNumber: "",
					carType: "",
					useProperty: "",
					commercialinsuranceTotal: "",
					driverLicense: "",
					vin: "",
					id: "",
					ower: "",
					email: "",
					passengerWeight: "",
					contactName: "",
					engineNum: "",
					updateUser: "",
					updateTime: "",
					firstRecordDate: "",
					plateNum: "",
					insuranceStopDate: "",
					carAge: "",
					realValue: "",
					companyId: "",
					createTime: "",
					createUser: "",
					postCode: "",
					insuredAddress: "",
					contactPhone: "",
					insuranceStartDate: "",
					//					carModel: "",
					carLevel: '',
					carValue: '',
					commercialinsuranceDiscount: '',
					coupulsoryDiscount: '',
				},
				comFormData: {
					insured: "",
					carAge: '',
					passengerWeight: "",
					contactName: "",
					engineNum: "",
					updateUser: "",
					updateTime: "",
					firstRecordDate: "",
					plateNum: "",
					InsuredIdNumber: "",
					realValue: "",
					companyId: "",
					carType: "",
					createTime: "",
					useProperty: "",
					driverLicense: "",
					createUser: "",
					vin: "",
					postCode: "",
					id: "",
					insuredAddress: "",
					power: "",
					contactPhone: "",
					email: "",
					carModel: "",
					insuranceCompany: "",
					insuranceEndDate: ""
				},
				emptyData: {
					insured: "",
					carAge: '',
					passengerWeight: "",
					contactName: "",
					engineNum: "",
					updateUser: "",
					updateTime: "",
					firstRecordDate: "",
					plateNum: "",
					InsuredIdNumber: "",
					realValue: "",
					companyId: "",
					carType: "",
					createTime: "",
					useProperty: "",
					driverLicense: "",
					createUser: "",
					vin: "",
					postCode: "",
					id: "",
					insuredAddress: "",
					power: "",
					contactPhone: "",
					email: "",
					carModel: "",
					insuranceCompany: "",
					insuranceEndDate: ""
				},
				comFormDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: ""
				},
				emptyDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: ""
				},
				//保险出单验证
				bxOrderRule: {
					//					outOrderDate: [{
					//						type: 'date',
					//						required: true,
					//						message: '请选择出单日期',
					//						trigger: 'blur'
					//					}],
					payPeople: [{
						required: true,
						message: '请填写交款人',
						trigger: 'blur'
					}],
					payType: [{
						required: true,
						message: '请填写支付方式',
						trigger: 'blur'
					}],
					commercialinsuranceNum: [{
						required: true,
						message: '请填写商业险合同号',
						trigger: 'blur'
					}],
					commercialinsuranceStartDate: [{
						type: 'date',
						required: true,
						message: '请选择商业险开始日期',
						trigger: 'blur'
					}],
					commercialinsuranceStopDate: [{
						type: 'date',
						required: true,
						message: '请选择商业险结束日期',
						trigger: 'blur'
					}],
					commissionSyTemp: [{
						//						type: "number",
						required: true,
						message: '请填写商业险临时佣金',
						trigger: 'blur'
					}],
					compulsoryNum: [{
						required: true,
						message: '请填写交强险合同号',
						trigger: 'blur'
					}],
					compulsoryStartDate: [{
						type: 'date',
						required: true,
						message: '请选择交强险开始日期',
						trigger: 'blur'
					}],
					compulsoryStopDate: [{
						type: 'date',
						required: true,
						message: '请选择交强险结束日期',
						trigger: 'blur'
					}],
					commissionJq: [{
						required: true,
						message: '请填写临时佣金',
						trigger: 'blur'
					}],
					commissionSy: [{
						required: true,
						message: '请填写临时佣金',
						trigger: 'blur'
					}],
					commissionJqTemp: [{
						//						type: "number",
						required: true,
						message: '请填写交强险临时佣金',
						trigger: 'blur'
					}],
					backPrice: [{
						required: true,
						message: '请填写返现金额',
						trigger: 'blur'
					}],
					baseType: [{
						required: true,
						message: '请选择基盘类别',
						trigger: 'blur'
					}],
					carProperty: [{
						required: true,
						message: '请选择新车属性',
						trigger: 'blur'
					}],
					salesProperty: [{
						required: true,
						message: '请选择销售属性',
						trigger: 'blur'
					}],
				},
				multipleSelection: [],
				multipleSelections: [],
				companyId: "",
				syxCombo: [],
				jqxCombo: [],
				bxCombo: [],
				jqorsy: "", //0是交强1是商业
				presentQId: '',
				presentCarId: '',
				insuranceCompanyId: '',
				qid: '',
				outStatus: false,
				addOrEdit: true,
				//合同号尾数
				numberone: '',
				searchdataNumber: "",
				//店端加投费率是否可填写
				addCommissionReadonly: false,
				//店端加投金额是否可填写
				addCommissionPriceReadonly: false,
				//交强险合同号长度
				jqNumberLenght: '',
				//商业险合同号长度
				syNumberLenght: '',
			}
		},
		watch: {
			//			:function(A){
			//				alert("232323"+A);
			//			},
		},
		methods: {
			//店端加投金额和店端加投费率只能填写一个
			addChangeFunction: function() {
				//新增
				debugger;
				if(this.$data.orderFromData.addCommission == "" && this.$data.orderFromData.addCommissionPrice == "") {
					//店端加投费率和店端加投金额同时为空
					this.$data.addCommissionReadonly = false;
					this.$data.addCommissionPriceReadonly = false;
				} else if(this.$data.orderFromData.addCommission != "" && this.$data.orderFromData.addCommission != null) {
					//店端加投费率不为空，不能再填写店端加投金额
					this.$data.addCommissionPriceReadonly = true;
					this.$data.addCommissionReadonly = false;
				} else if(this.$data.orderFromData.addCommissionPrice != "" && this.$data.orderFromData.addCommissionPrice != null) {
					//店端加投金额不为空，不能填写店端加投费率
					this.$data.addCommissionReadonly = true;
					this.$data.addCommissionPriceReadonly = false;
				} else {
					this.$data.addCommissionReadonly = false;
					this.$data.addCommissionPriceReadonly = false;
				}
			},
			//新增时查询方式缓存
			queryTypeSave: function() {
				window.localStorage.setItem("orderQueryType", this.$data.conditions.key);
			},
			//新增客户档案时被保险人 = 联系人 = 行驶证车主
			peopleChange: function() {
				this.$data.customerData.contactName = this.$data.customerData.insured;
				this.$data.customerData.driverLicense = this.$data.customerData.insured;
			},
			//获取保险公司模板
			getTemplateShow: function() {
				debugger;
				this.$http({
					method: 'POST',
					url: this.API_ROOT + '/insurance/info',
					params: {
						id: this.$data.QuotationFrom.paramQuotation.insuranceCompanyId,
					}
				}).then(function(resp) {
					debugger;
					if(resp.data.success) {
						this.$data.templateShow = resp.data.data.templet;
					}
				}, resp => {

				});
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.searchCarShow = true;
			},
			//保存客户档案
			saveCustomer: function() {
				debugger;
				if(this.$data.customerData.source == '0' && this.isCardNo(this.$data.customerData.insuredIdNumber) == false) {
					this.$message.error("请填写正确的身份证号");
				} else if(this.$data.customerData.vin.length != 17) {
					this.$message.error("请填写正确的车架号");
				} else if(this.$data.customerData.plateNum == '') {
					this.$confirm('确定不填写车牌号吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.$refs.customer.validate(function(valid, $event) {
							// 验证通过
							if(valid) {
								debugger;
								this.$data.customerData.firstRecordDate = this.momentFu(this.$data.firstRecordDates);
								if(this.$data.customerData.firstRecordDate == null || this.$data.customerData.firstRecordDate == "") {
									this.$message.error("请选择初次登记日期");
									return false;
								}
								if(this.$data.customerData.firstRecordDate) {
									this.$http.post(this.API_ROOT + '/insurance/car/save', this.$data.customerData)
										.then(resp => {
											if(resp.data.success) {
												debugger;
												if(this.$data.customerData.plateNum) {
													this.$data.conditions.key = "0";
													this.$data.conditions.value = this.$data.customerData.plateNum;
													this.carQuery();
												} else {
													this.$data.conditions.key = "1";
													this.$data.conditions.value = this.$data.customerData.vin;
													this.carQuery();
												}
												this.$data.QuotationFrom.paramQuotation.insureType = 'sb';
												this.$data.QuotationFrom.paramQuotation.insuranceStartDate = this.$data.customerData.firstRecordDate;
												this.$data.customerShow = false;
												this.$message(resp.data.msg);
											} else {
												this.$message.error(resp.data.msg);
											}
										}, resp => {

										});
								}
							} else {
								return false
							}
						}.bind(this))
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '取消'
						});
					});
				} else {
					this.$refs.customer.validate(function(valid, $event) {
						// 验证通过
						if(valid) {
							debugger;
							this.$data.customerData.firstRecordDate = this.momentFu(this.$data.firstRecordDates);
							if(this.$data.customerData.firstRecordDate == null || this.$data.customerData.firstRecordDate == "") {
								this.$message.error("请选择初次登记日期");
								return false;
							}
							if(this.$data.customerData.firstRecordDate) {
								this.$http.post(this.API_ROOT + '/insurance/car/save', this.$data.customerData)
									.then(resp => {
										if(resp.data.success) {
											debugger;
											this.$data.conditions.key = "0";
											this.$data.conditions.value = this.$data.customerData.plateNum;
											this.carQuery();
											this.$data.customerShow = false;
											this.$message(resp.data.msg);
										} else {
											this.$message.error(resp.data.msg);
										}
									}, resp => {

									});
							}
						} else {
							return false
						}
					}.bind(this))
				}
			},
			//不计免赔何在一起
			startChangeTwo: function(num) {
				debugger;
				if(num == "0") {
					//车船税
					if(this.$data.intem[0].starts == true) {
						this.$data.intem[1].starts = true;
					}
					if(this.$data.intem[0].starts == false) {
						this.$data.intem[1].starts = false;
						this.$data.intem[0].price = "";
						this.$data.intem[1].price = "";
					}
				} else if(num == "1") {
					//交强险
					if(this.$data.intem[1].starts == true) {
						this.$data.intem[0].starts = true;
					}
					if(this.$data.intem[1].starts == false) {
						this.$data.intem[0].starts = false;
						this.$data.intem[0].price = "";
						this.$data.intem[1].price = "";
					}
				} else if(num == "8") {
					//车上人员-司机
					if(this.$data.intem[8].starts == true) {
						this.$data.intem[8].limit = "1";
					}
					if(this.$data.intem[8].starts == false) {
						this.$data.intem[8].limit = "";
						this.$data.intem[8].price = "";
					}
				} else if(num == "9") {
					//车上人员-乘客
					if(this.$data.intem[9].starts == true) {
						this.$data.intem[9].limit = "4";
					}
					if(this.$data.intem[9].starts == false) {
						this.$data.intem[9].limit = "";
						this.$data.intem[9].price = "";
					}
				} else if(this.$data.intem[num].starts == false) {
					this.$data.intem[num].limit = "";
					this.$data.intem[num].price = "";
				}
				this.sumPrice();
			},
			//不计免赔分开选择险种自动选中不计免赔
			startChange: function(num) {
				debugger;
				if(num == "0") {
					//交强险
					if(this.$data.intem[0].starts == true) {
						this.$data.intem[1].starts = true;
					}
					if(this.$data.intem[0].starts == false) {
						this.$data.intem[1].starts = false;
						this.$data.intem[0].price = "";
						this.$data.intem[1].price = "";
					}
				} else if(num == "1") {
					if(this.$data.intem[1].starts == true) {
						this.$data.intem[0].starts = true;
					}
					if(this.$data.intem[1].starts == false) {
						this.$data.intem[0].starts = false;
						this.$data.intem[0].price = "";
						this.$data.intem[1].price = "";
					}
				} else if(num == "2") {
					//车辆损失险
					if(this.$data.intem[2].starts == true) {
						this.$data.intem[3].starts = true;
					}
					if(this.$data.intem[2].starts == false) {
						this.$data.intem[3].starts = false;
						this.$data.intem[2].price = "";
						this.$data.intem[3].price = "";
					}
				} else if(num == "4") {
					//第三者责任险
					if(this.$data.intem[4].starts == true) {
						this.$data.intem[5].starts = true;
					}
					if(this.$data.intem[4].starts == false) {
						this.$data.intem[5].starts = false;
						this.$data.intem[4].price = "";
						this.$data.intem[5].price = "";
						this.$data.intem[4].limit = "";
						this.$data.intem[5].limit = "";
					}
				} else if(num == "6") {
					//盗抢险
					if(this.$data.intem[6].starts == true) {
						this.$data.intem[7].starts = true;
					}
					if(this.$data.intem[6].starts == false) {
						this.$data.intem[7].starts = false;
						this.$data.intem[6].price = "";
						this.$data.intem[7].price = "";
					}
				} else if(num == "8") {
					//车上人员责任险-司机.司机
					if(this.$data.intem[8].starts == true) {
						this.$data.intem[10].starts = true;
						this.$data.intem[8].limit = '1';
						this.$data.intem[10].limit = '1';
					}
					if(this.$data.intem[8].starts == false) {
						this.$data.intem[10].starts = false;
						this.$data.intem[8].price = "";
						this.$data.intem[10].price = "";
						this.$data.intem[8].limit = "";
						this.$data.intem[10].limit = "";
					}
				} else if(num == "9") {
					//车上人员责任险-乘客
					if(this.$data.intem[9].starts == true) {
						this.$data.intem[11].starts = true;
						this.$data.intem[9].limit = '4';
						this.$data.intem[11].limit = '4';
					}
					if(this.$data.intem[9].starts == false) {
						this.$data.intem[11].starts = false;
						this.$data.intem[9].price = "";
						this.$data.intem[11].price = "";
						this.$data.intem[9].limit = "";
						this.$data.intem[11].limit = "";
					}
				} else if(num == "12") {
					//车身划痕险
					if(this.$data.intem[12].starts == true) {
						this.$data.intem[13].starts = true;
					}
					if(this.$data.intem[12].starts == false) {
						this.$data.intem[13].starts = false;
						this.$data.intem[12].price = "";
						this.$data.intem[13].price = "";
					}
				} else if(num == "14") {
					//自然损失险
					if(this.$data.intem[14].starts == true) {
						this.$data.intem[15].starts = true;
					}
					if(this.$data.intem[14].starts == false) {
						this.$data.intem[15].starts = false;
						this.$data.intem[14].price = "";
						this.$data.intem[15].price = "";
					}
				} else if(num == "16") {
					//发动机涉水险
					if(this.$data.intem[16].starts == true) {
						this.$data.intem[17].starts = true;
					}
					if(this.$data.intem[16].starts == false) {
						this.$data.intem[17].starts = false;
						this.$data.intem[16].price = "";
						this.$data.intem[17].price = "";
					}
				} else if(num == "26") {
					//发动机涉水险
					if(this.$data.intem[26].starts == true) {
						this.$data.intem[27].starts = true;
					}
					if(this.$data.intem[26].starts == false) {
						this.$data.intem[27].starts = false;
						this.$data.intem[26].price = "";
						this.$data.intem[27].price = "";
					}
				} else {
					if(this.$data.intem[num].starts == false) {
						this.$data.intem[num].price = "";
						this.$data.intem[num].limit = "";
					}
				}
				this.sumPrice();

			},
			//保险出单
			orderClick: function() {

				this.$data.outStatus = true;
				this.comFormShowsSure();
			},
			//根据活动查询优惠券号
			queryCoupon: function() {
				debugger;
				var companyId = window.localStorage.getItem("companyId");
				this.$http.get(this.API_ROOT + '/crm/coupon/insurance/page', {
					params: {
						activityId: this.$data.presentData.activityId,
						vin: this.$data.checkData.vin,
						companyId: companyId,
						plateNum: this.$data.checkData.plateNum
					}
				}).then((response) => {
					debugger;
					if(response.data.success) {
						this.$data.presentDataList = response.data.dataList;
					}
				}, (response) => {});
			},
			//选中优惠券
			selectCoupon: function(index) {
				debugger;
				this.$http.get(this.API_ROOT + '/crm/coupon/insurance/save', {
					params: {
						id: this.$data.presentDataList[index].id,
						qId: this.$data.presentQId
					}
				}).then((response) => {
					debugger;
					this.queryCoupon();
					this.queryPresent(this.$data.presentCarId, this.$data.presentQId);
				}, (response) => {
					debugger;
				});
			},
			//增加赠品按钮
			addPresent: function() {
				this.$data.presentShow = true;
				this.queryActivity();
			},
			//保存赠品信息
			savePresent: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/crm/coupon/createInsuranceActivityCoupon', {
					params: {
						activityId: this.$data.presentData.activityId,
						nums: this.$data.presentData.nums,
						carId: this.$data.presentCarId,
						qId: this.$data.presentQId
					}
				}).then((response) => {
					debugger;
					//					this.$data.pretableData.dataList=response.data.data;
					this.$data.presentShow = false;
					this.queryPresent(this.$data.presentCarId, this.$data.presentQId);
				}, (response) => {
					debugger;
				});

			},
			//查询赠品信息
			queryPresent: function(id, qid) {
				this.$http.get(this.API_ROOT + '/crm/coupon/getInsuranceActivityCoupon', {
					params: {
						carId: id,
						qId: qid
					}
				}).then((response) => {
					this.$data.pretableData.dataList = response.data.data;
					//					this.$data.presentShow=false;
				}, (response) => {
					debugger;
				});
			},
			//删除赠品
			presentDelete: function(index, row) {
				this.$http.get(this.API_ROOT + '/crm/coupon/delInsuranceActivityCoupon', {
					params: {
						couponId: row.id,
					}
				}).then((response) => {
					debugger;
					this.$message(response.data.msg);
					this.queryPresent(this.$data.presentCarId, this.$data.presentQId);
				}, (response) => {
					debugger;
				});
			},
			//取消出单时 删除赠品信息
			outPresentDelete: function() {
				debugger;

				if(this.$data.containSure == false) {
					this.$data.orderShow = false;
				} else if(this.$data.pretableData.dataList.length == 0) {
					this.$data.orderShow = false;
				} else {
					//shanchu 赠品信息
					for(var i = 0; i < this.$data.pretableData.dataList.length; i++) {
						this.$http.get(this.API_ROOT + '/crm/coupon/delInsuranceActivityCoupon', {
							params: {
								couponId: this.$data.pretableData.dataList[i].id,
							}
						}).then((response) => {}, (response) => {
							debugger;
						});
					};
					this.$data.orderShow = false;
				}
			},
			//请求已经选中的报价单项目
			intemInfo: function() {
				//debugger;
				this.$http.get(this.API_ROOT + '/insurance/QuotationItem/hasQuotationList', {
					params: {
						id: this.$data.checkData.qid
					}
				}).then((response) => {
					debugger;
					for(var j = 0; j < this.$data.intem.length; j++) {
						this.$data.intem[j].starts = false;
						this.$data.intem[j].limit = "";
						this.$data.intem[j].price = "";
					}

					var respData = response.data
					for(var i = 0; i < respData.length; i++) {
						for(var j = 0; j < this.$data.intem.length; j++) {
							if(this.$data.intem[j].id == respData[i].itemId) {
								this.$data.intem[j].starts = true;
								this.$data.intem[j].limit = respData[i].itemLimit;
								this.$data.intem[j].price = respData[i].itemPrice;
								break;
							}
						}
					}
					this.sumPrice();
				}, (response) => {
					debugger;
				});
			},
			//复制请求单
			copyQQ: function() {
				debugger;
				var copyText = this.$data.qqFromData.qqText;
				copy(copyText);
				//copy("copyText");
				//copyText.execCommand("copy");
			},
			//时间默认计算
			dateChange: function() {
				debugger;
				var star = this.$data.orderFromData.commercialinsuranceStartDate;
				if(this.$data.orderFromData.commercialinsuranceStartDate == "") {
					this.$data.orderFromData.commercialinsuranceStopDate = "";
				} else {
					this.$data.orderFromData.commercialinsuranceStopDate = new Date(this.moment(star).add(12, "month").add(-1, "day"))
				}
			},
			//时间默认计算
			dateChanges: function() {
				debugger;
				var star = this.$data.orderFromData.compulsoryStartDate;
				if(this.$data.orderFromData.compulsoryStartDate == "") {
					this.$data.orderFromData.compulsoryStopDate = "";
				} else {
					this.$data.orderFromData.compulsoryStopDate = new Date(this.moment(star).add(12, "month").add(-1, "day"))
				}
			},
			comFormShowsClose: function() {
				this.$confirm('此操作将不会保存输入的数据, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.companyQuery();
					this.$data.comFormShows = false;
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			},
			//点击请求单
			qqClick: function() {
				debugger;
				var itemsNames = "";
				for(var i = 0; i < this.$data.intem.length; i++) {
					if(this.$data.intem[i].starts == true) {
						if(i == 2) {
							itemsNames += this.$data.intem[i].name + "，";
						} else if(i == 4 || i == 5) {
							itemsNames += this.$data.intem[i].name + "限额：" + this.$data.intem[i].limit + "元，";
						} else if(i == 8 || i == 9 || i == 10 || i == 11) {
							itemsNames += this.$data.intem[i].name + "限额：" + this.$data.intem[i].limit + "万，";
						} else {
							itemsNames += this.$data.intem[i].name + "，";
						}
					}
				}
				this.$data.qqFromData.qqText = "车牌号为" + this.$data.infoData.plateNum + ",车架号为" + this.$data.infoData.vin + "的车辆投保,项目包括" + itemsNames + "请给予报价。"
				this.$data.qqShow = true;
			},
			//三者，车上保额赋给不计免赔
			quotaChange: function(num) {
				if(num == "4") {
					this.$data.intem[5].limit = this.$data.intem[4].limit;
				} else if(num == "8") {
					this.$data.intem[10].limit = this.$data.intem[8].limit;
				} else if(num == "9") {
					this.$data.intem[11].limit = this.$data.intem[9].limit;
				}
			},
			//计算价格
			sumPrice: function() {
				//				compulsoryTotal 交强 险总价
				//              commercialinsuranceTotal 商业险总价
				//总价格
				debugger;
				var sumPrice = 0;
				for(var i = 0; i < this.$data.intem.length; i++) {
					if(this.$data.intem[i].starts == true && this.$data.intem[i].price != "") {
						this.$data.intem[i].price = Number(this.$data.intem[i].price);
						sumPrice = sumPrice + this.$data.intem[i].price;
					}
				}
				debugger;
				if(this.$data.intem[0].starts == true) {
					this.$data.ccsjg = Number(this.$data.intem[0].price).toFixed(2);
				} else {
					this.$data.ccsjg = 0;
				}
				if(this.$data.intem[1].starts == true) {
					this.$data.jqxbj = Number(this.$data.intem[1].price).toFixed(2);
				} else {
					this.$data.jqxbj = 0;
				}
				this.$data.syxbj = Number(sumPrice - this.$data.jqxbj - this.$data.ccsjg).toFixed(2);
				this.$data.sum = (Number(this.$data.jqxbj) + Number(this.$data.syxbj) + Number(this.$data.ccsjg)).toFixed(2);
				this.$data.orderFromData.commercialinsurancePrice = Number(this.$data.syxbj).toFixed(2); //商业
				this.$data.orderFromData.compulsoryPrice = Number(Number(this.$data.jqxbj) + Number(this.$data.ccsjg)).toFixed(2); //交强
				this.$data.infoData.commercialinsuranceTotal = Number(this.$data.syxbj).toFixed(2); //update的时候
				this.$data.infoData.compulsoryTotal = Number(Number(this.$data.jqxbj) + Number(this.$data.ccsjg)).toFixed(2);
			},
			//点击响应单
			xyClick: function() {
				//debugger;
				//响应单的内容组合
				var itemsNames = "";
				//总价格
				//var sumPrice=0;
				for(var i = 0; i < this.$data.intem.length; i++) {
					if(this.$data.intem[i].starts == true) {
						if(i == 2) {
							itemsNames +=
								this.$data.intem[i].name + "(" + this.$data.intem[i].price + ");";
						} else if(i == 4 || i == 5) {
							itemsNames +=
								this.$data.intem[i].name +
								"限额：" +
								this.$data.intem[i].limit +
								"元，保险费：" +
								this.$data.intem[i].price +
								"元；";
						} else if(i == 8 || i == 9 || i == 10 || i == 11) {
							itemsNames +=
								this.$data.intem[i].name +
								"限额：" +
								this.$data.intem[i].limit +
								"万，保险费：" +
								this.$data.intem[i].price +
								"元；";
						} else {
							itemsNames +=
								this.$data.intem[i].name + "(" + this.$data.intem[i].price + "),";
						}
					}
				}
				//调用价格计算
				this.sumPrice();
				//获得保险公司名称
				var insuranceName;
				if(this.$data.checkData.insuranceCompanyName) {
					insuranceName = this.$data.checkData.insuranceCompanyName;
				} else {
					for(var i = 0; i < this.$data.companyCombo.length; i++) {
						if(this.$data.QuotationFrom.paramQuotation.insuranceCompanyId = this.$data.companyCombo[i].value) {
							insuranceName = this.$data.companyCombo[i].label;
							break;
						}
					}
				}

				debugger;
				//商业新优惠价格
				var syPrice = 0;
				//交强险优惠价格
				var jqPrice = 0;
				if(this.$data.QuotationFrom.paramQuotation.commercialinsuranceDiscount) {
					syPrice = Number(this.$data.syxbj) * Number(this.$data.QuotationFrom.paramQuotation.commercialinsuranceDiscount) / 100;
					syPrice = Number(syPrice).toFixed(2);
				}
				if(this.$data.QuotationFrom.paramQuotation.coupulsoryDiscount) {
					jqPrice = Number(this.$data.jqxbj) * Number(this.$data.QuotationFrom.paramQuotation.coupulsoryDiscount) / 100;
					jqPrice = Number(jqPrice).toFixed(2);
				}
				//合计
				var sum = parseFloat(this.$data.jqxbj) + parseFloat(this.$data.syxbj) + parseFloat(this.$data.ccsjg);
				//优惠后合计
				var sumPrice = parseFloat(sum) - parseFloat(syPrice) - parseFloat(jqPrice);
				sumPrice = Number(sumPrice).toFixed(2);
				debugger;
				this.$data.xyFromData.xyText =
					"尊敬的客户【" +
					this.$data.infoData.contactName +
					"】" +
					"您好,您的车险即将到期," + insuranceName + "给的报价为:" +
					"商业险:" +
					parseFloat(this.$data.syxbj) +
					"元,交强险:" +
					parseFloat(this.$data.jqxbj) +
					"元,车船税:" +
					parseFloat(this.$data.ccsjg) +
					"元,保险方案为:(" +
					itemsNames +

					"),合计：" +
					sum +
					",优惠价格为:" +
					(parseFloat(syPrice) +
						parseFloat(jqPrice)) +
					",优惠后实交保费为:" +
					sumPrice;
				this.$data.xyShow = true;
			},
			//状态转换
			statusCov: function(row, column) {
				switch(row.status) {
					case "0":
						return "进行中";
						break;
					case "1":
						return "已过期";
						break;
					case "2":
						return "已出单";
						break;
					default:
						return "进行中";
				}
			},
			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
				if(this.$data.multipleSelection.length == 1) {
					this.$http({
						method: 'POST',
						url: this.API_ROOT + '/insurance/info',
						params: {
							id: this.$data.multipleSelection[0].insuranceCompanyId,
						}
					}).then(function(resp) {
						debugger;
						if(resp.data.success) {
							this.$data.templateShow = resp.data.data.templet;
						}
					}, resp => {

					});
				}
			},
			//选择框
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
			},
			add: function() { //TODO
				var empty = {
					paramQuotation: {
						carId: "", //车辆ID
						carAge: '', //车龄
						insuranceCompanyId: "", //保险公司ID
						contactPeople: "", //联系人
						contactPhone: "", //联系电话
						insuranceStartDate: "", //保险起始日期
						insuranceStopDate: "", //保险终止日期
						ompulsoryTotal: "", //交强险总价
						commercialinsuranceTotal: "", //商业险总价
						remark: "", //备注
						insureType: '', //投保类别
					},
					insurance: ''
				};
				debugger;

				var queryType = window.localStorage.getItem("orderQueryType");
				//车架号还是车牌号查询
				if(queryType == null || queryType == "") {
					this.$data.conditions.key = "0";
				} else {
					this.$data.conditions.key = queryType;
				}
				this.$data.conditions.value = "";
				this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
				this.$data.QuotationFrom = Object.assign(this.$data.QuotationFrom, empty);
				this.$data.comFormShow = true;
				this.$data.addOrEdit = true;
				this.$data.checkData = {};
			},
			//保存保险出单
			saveOrder: function() {
				debugger;
				if(this.$data.orderFromData.compulsoryNum == this.$data.orderFromData.commercialinsuranceNum) {
					this.$message.error("商业险合同号与交强险合同号不能相同！");
					return false;
				};
				if(this.$data.orderFromData.outOrderDate == "") {
					this.$message.error("请选择出单日期！");
					return false;
				}
				this.$refs.bxOrderForms.validate(function(valid, $event) {
					// 验证通过
					if(valid) {
						this.$confirm("出单日期为：" + this.$data.orderFromData.outOrderDate + "   请确认信息填写正确，然后点确认按钮出单.", '提示', { //出单询问
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(() => {
							this.$data.fullscreenloading = true;
							this.$data.orderFromData.carId = this.$data.presentCarId;
							this.$data.orderFromData.quotationId = this.$data.presentQId;
							this.$data.orderFromData.outOrderDate = this.momentFu(this.$data.orderFromData.outOrderDate);
							this.$data.orderFromData.commercialinsuranceStartDate = this.momentFu(this.$data.orderFromData.commercialinsuranceStartDate);
							this.$data.orderFromData.commercialinsuranceStopDate = this.momentFu(this.$data.orderFromData.commercialinsuranceStopDate);
							this.$data.orderFromData.compulsoryStartDate = this.momentFu(this.$data.orderFromData.compulsoryStartDate);
							this.$data.orderFromData.compulsoryStopDate = this.momentFu(this.$data.orderFromData.compulsoryStopDate);
							this.$data.orderFromData.insuranceCompanyId = this.$data.insuranceCompanyId;
							this.$data.orderFromData.continuous = this.$data.continuous; //是否联保
							debugger;
							this.$http.post(this.API_ROOT + '/insurance/Order/save', this.$data.orderFromData, { //TODO
								params: {}
							}).then(resp => {
								this.$data.fullscreenloading = false;
								if(resp.data.success) {
									debugger;
									this.$message(resp.data.msg);
									this.$data.orderShow = false;
									//隐藏
									this.$data.itemShow = false;
									this.companyQuery();

								} else {
									this.$data.orderFromData.commercialinsuranceStartDate = new Date(this.$data.orderFromData.commercialinsuranceStartDate);
									this.$data.orderFromData.commercialinsuranceStopDate = new Date(this.$data.orderFromData.commercialinsuranceStopDate);
									this.$data.orderFromData.compulsoryStartDate = new Date(this.$data.orderFromData.compulsoryStartDate);
									this.$data.orderFromData.compulsoryStopDate = new Date(this.$data.orderFromData.compulsoryStopDate);
									this.$message.error(resp.data.msg);
								}
							}, resp => {});
						}).catch(() => {
							this.$message({
								type: 'info',
								message: '取消出单'
							});
						});

					}
				}.bind(this))
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//保存新增的项目
			saveItem: function() {
				this.$data.intmFromData.quotationId = this.$data.checkData.qid;
				this.$data.intmFromData.type = this.$data.jqorsy;
				debugger;
				this.$http.post(this.API_ROOT + '/insurance/QuotationItem/singleSave', this.$data.intmFromData, {
					params: {}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						//调用刷新
						this.itmeQueryJq();
						this.itmeQuerySy();
						//隐藏
						this.$data.itemShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//查询车辆
			carQuery: function() {
				this.$http({
					method: 'POST',
					url: this.API_ROOT + '/insurance/car/info',
					params: {
						key: this.$data.conditions.key,
						value: this.$data.conditions.value,
					}
				}).then(function(resp) {
					if(resp.data.success) {
						debugger;
						this.$data.comFormData = Object.assign(this.$data.comFormData, resp.data.data);
						this.$data.QuotationFrom.paramQuotation.carId = resp.data.data.id;
						this.$data.QuotationFrom.insurance = resp.data.data.insurance;
						this.$data.QuotationFrom.paramQuotation.contactPeople = resp.data.data.insured;
						this.$data.QuotationFrom.paramQuotation.contactPhone = resp.data.data.contactPhone;
						if(this.$data.comFormData.insuranceEndDate) {
							var newDate = new Date(this.$data.comFormData.insuranceEndDate);
							this.$data.QuotationFrom.paramQuotation.insuranceStartDate = newDate.setDate(newDate.getDate() + 1);
							this.$data.QuotationFrom.paramQuotation.insureType = "xb";
						}
					} else {
						//						this.$message.error(resp.data.msg);
						this.$confirm('未查询到客户信息，是否要新增客户档案', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(() => {
							this.$data.customerShow = true;
							this.$data.customerData = Object.assign(this.$data.customerData, this.$data.customerEmptyData);
						}).catch(() => {
							this.$message({
								type: 'info',
								message: '已取消'
							});
						});
					}
				}, function(error) {})
			},
			//出单
			outOrderfun: function(index) { //TODO
				this.$data.addCommissionReadonly = false;
				this.$data.addCommissionPriceReadonly = false;
				debugger;
				this.$data.orderFromData.isCommissionJqTemp = false;
				this.$data.orderFromData.isCommissionSyTemp = false;
				this.$data.syItemsShow = false;
				this.$data.jqItemsShow = false;
				this.$data.comFormShows = false;
				var qId = this.$data.tableData.dataList[index].qid;
				var carId = this.$data.tableData.dataList[index].id;
				this.$data.checkData = this.$data.tableData.dataList[index];
				this.$data.presentQId = qId;
				this.$data.presentCarId = carId;
				this.$data.insuranceCompanyId = this.$data.tableData.dataList[index].insuranceCompanyId;
				//查询保险单
				this.$http.get(this.API_ROOT + '/insurance/Order/info', {
					params: {
						qId: qId,
						carId: carId
					}
				}).then((response) => {
					debugger;
					if(response.data.data.syItems == 0 && response.data.data.jqItems == 0) {
						this.$message.error("还未录入保险项目，请先进行设置录入");
						return false;
					} else {
						this.$data.orderFromData = Object.assign(this.$data.orderFromData, this.$data.emptyOrderFromData);
						this.$data.orderFromData.insuranceCommissionerId = window.localStorage.getItem("uid");
						this.$data.orderFromData.carProperty = this.$data.checkData.carProperty; //新车属性
						this.$data.orderFromData.salesProperty = this.$data.checkData.salesProperty; //销售属性
						if(response.data.data.syItems > 0) {
							this.$data.syItemsShow = true;
							this.$data.orderFromData.commercialinsuranceStartDate = new Date(this.$data.tableData.dataList[index].insuranceStartDate);
							this.$data.orderFromData.commercialinsuranceStopDate = new Date(this.$data.tableData.dataList[index].insuranceStopDate);
						};
						if(response.data.data.jqItems > 0) {
							this.$data.jqItemsShow = true;
							this.$data.orderFromData.compulsoryStartDate = new Date(this.$data.tableData.dataList[index].insuranceStartDate);
							this.$data.orderFromData.compulsoryStopDate = new Date(this.$data.tableData.dataList[index].insuranceStopDate);
						};
						if(response.data.data.id) {
							//this.$data.orderInfoData=response.data.data;
							this.$data.orderFromData = response.data.data;
							this.$data.orderFromData.compulsoryNum = response.data.data.compulsoryNum;
							this.$data.orderFromData.commercialinsuranceNum = response.data.data.commercialinsuranceNum;
							this.$data.orderShow = true; //出单弹出框
							if(this.$data.orderFromData.continuous) {
								this.$data.continuous = this.$data.orderFromData.continuous;
							} else {
								this.$data.continuous = 'false';
							}

							this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
							this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
							this.$data.containSure = false;
						} else {
							if(this.$data.tableData.dataList[index].insureType == 'sb') {
								for(var i = 0; i < this.$data.insTypeConvertData.length; i++) {
									if(this.$data.insTypeConvertData[i].label == '新保') {
										this.$data.orderFromData.baseType = this.$data.insTypeConvertData[i].id;
										break;
									}
								}
							};
							//							if(this.$data.tableData.dataList[index].insureType == 'sb') {
							//								this.$data.orderFromData.baseType = this.$data.tableData.dataList[index].insureType;
							//							};
							this.$data.orderFromData.outOrderDate = new Date(); //出单日期默认今天
							this.$data.orderFromData.outOrderDate = this.momentFu(this.$data.orderFromData.outOrderDate);
							this.$data.containSure = true;
							this.$data.orderShow = true; //出单弹出框
							this.$data.continuous = 'false';
							this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
							this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
							var id = this.$data.checkData.insuranceCompanyId || this.$data.tableData.dataList[index].insuranceCompanyId;
							this.queryInsuranceNumber(this.$data.orderFromData.outOrderDate, id, this.$data.tableData.dataList[index].storeCode); //查询商业险合同号
						}
						if(this.$data.orderFromData.isCommissionJqTemp == "true") {
							this.$data.orderFromData.isCommissionJqTemp = true;
						} else {
							this.$data.orderFromData.isCommissionJqTemp = false;
						};
						if(this.$data.orderFromData.isCommissionSyTemp == "true") {
							this.$data.orderFromData.isCommissionSyTemp = true;
						} else {
							this.$data.orderFromData.isCommissionSyTemp = false;
						};

						this.$data.orderFromData.payPeople = this.$data.tableData.dataList[index].insured;
						//this.companyQuery();
						this.queryCommission(this.$data.orderFromData.outOrderDate, qId, this.$data.tableData.dataList[index].storeCode);
						this.queryPresent(carId, qId); //查询添加的赠品信息
					}
				}, (response) => {
					debugger;
				});
			},
			//查询保险公司预设合同号
			queryInsuranceNumber: function(time, insuranceCompanyId, id) {
				debugger;
				var time = this.momentFu(time);
				var companyId = window.localStorage.getItem("companyId");
				this.$http.get(this.API_ROOT + '/insurance/contract', {
					params: {
						time: time, //出单日期
						companyId: id, //公司ID
						insuranceCompanyId: insuranceCompanyId //保险公司ID
					}
				}).then((response) => {
					debugger;
					if(response.data.success) {
						//商业险预设合同号
						this.$data.orderFromData.compulsoryNum = response.data.data.contractJqNo;
						//交强险预设合同号
						this.$data.orderFromData.commercialinsuranceNum = response.data.data.contractSyNo;
						//交强险合同号预设长度
						if(response.data.data.contractJqLen == '0' || response.data.data.contractJqLen == null || response.data.data.contractJqLen == "") {
							this.$data.jqNumberLenght = "";
						} else {
							this.$data.jqNumberLenght = response.data.data.contractJqLen;
						}
						//商业险合同号预设长度
						if(response.data.data.contractSyLen == '0' || response.data.data.contractSyLen == null || response.data.data.contractSyLen == "") {
							this.$data.syNumberLenght = "";
						} else {
							this.$data.syNumberLenght = response.data.data.contractSyLen;
						}
					}
				})
			},
			//查询协议费率
			queryCommission: function(time, quotationId, id) {
				var type = ""; //保单类型
				//判断报价单类型
				if(this.$data.syItemsShow == true && this.$data.jqItemsShow == true) {
					type = 2; //交商共保
				} else if(this.$data.syItemsShow == true && this.$data.jqItemsShow == false) {
					type = 1; //单商业
				} else if(this.$data.syItemsShow == false && this.$data.jqItemsShow == true) {
					type = 1; //单交强
				}
				var companyId = window.localStorage.getItem("companyId");
				this.$http.get(this.API_ROOT + '/insurance/commission', {
					params: {
						quotationId: quotationId, //报价单ID
						time: time, //出单日期
						iscompulsoryinsurance: type, //保单类型
						companyId: id //公司ID

					}
				}).then((response) => {
					debugger;
					if(response.data.success) {
						if(response.data.data.sy == null) { //未设置商业险佣金清空商业险佣金和佣金iD
							this.$data.orderFromData.commissionSy = "";
							this.$data.orderFromData.commissionSyId = "";
						} else {
							this.$data.orderFromData.commissionSy = response.data.data.sy.commission;
							this.$data.orderFromData.commissionSyId = response.data.data.sy.id;
						}
						if(response.data.data.jq == null) { //未设置交强险佣金清空交强险佣金和ID
							this.$data.orderFromData.commissionJq = "";
							this.$data.orderFromData.commissionJqId = "";
						} else {
							this.$data.orderFromData.commissionJq = response.data.data.jq.commission;
							this.$data.orderFromData.commissionJqId = response.data.data.jq.id;
						}
					} else {
						this.$data.orderFromData.commissionJq = "";
						this.$data.orderFromData.commissionJqId = "";
						this.$data.orderFromData.commissionSy = "";
						this.$data.orderFromData.commissionSyId = "";
						this.$message.error(response.data.msg);
					}
				}, (response) => {
					debugger;
				});
			},
			//保险出单预警
			outOrdersave: function() { //TODO
				debugger;
				this.$data.syItemsShow = false;
				this.$data.jqItemsShow = false;
				this.$data.comFormShows = false;
				if(this.$data.addOrEdit == false) {
					var qId = this.$data.multipleSelection[0].qid;
					var carId = this.$data.multipleSelection[0].id;
					this.$data.checkData = this.$data.multipleSelection[0];
					this.$data.presentQId = qId;
					this.$data.presentCarId = carId;
					this.$data.insuranceCompanyId = this.$data.multipleSelection[0].insuranceCompanyId;
					//查询保险单
					this.$http.get(this.API_ROOT + '/insurance/Order/info', {
						params: {
							qId: qId,
							carId: carId
						}
					}).then((response) => {
						debugger;
						if(response.data.data.syItems == 0 && response.data.data.jqItems == 0) {
							this.$message.error("还未录入保险项目，请先进行设置录入");
							return false;
						} else {
							this.$data.orderFromData = Object.assign(this.$data.orderFromData, this.$data.emptyOrderFromData);
							if(response.data.data.syItems > 0) {
								this.$data.syItemsShow = true;
								this.$data.orderFromData.commercialinsuranceStartDate = new Date(this.$data.multipleSelection[0].insuranceStartDate);
								this.$data.orderFromData.commercialinsuranceStopDate = new Date(this.$data.multipleSelection[0].insuranceStopDate);
							}
							if(response.data.data.jqItems > 0) {
								this.$data.jqItemsShow = true;
								this.$data.orderFromData.compulsoryStartDate = new Date(this.$data.multipleSelection[0].insuranceStartDate);
								this.$data.orderFromData.compulsoryStopDate = new Date(this.$data.multipleSelection[0].insuranceStopDate);
							}
							if(response.data.data.id) {
								//this.$data.orderInfoData=response.data.data;
								this.$data.orderFromData = response.data.data;
								this.$data.orderFromData.compulsoryNum = response.data.data.compulsoryNum;
								this.$data.orderFromData.commercialinsuranceNum = response.data.data.commercialinsuranceNum;
								//出单按钮等待框消失
								this.$data.fullscreenloading = false;
								this.$data.orderShow = true; //出单弹出框
								if(this.$data.orderFromData.continuous) {
									this.$data.continuous = this.$data.orderFromData.continuous;
								} else {
									this.$data.continuous = 'false';
								}
								this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
								this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
								this.$data.containSure = false;
							} else {
								if(this.$data.multipleSelection[0].insureType == 'sb') {
									for(var i = 0; i < this.$data.insTypeConvertData.length; i++) {
										if(this.$data.insTypeConvertData[i].label == '新保') {
											this.$data.orderFromData.baseType = this.$data.insTypeConvertData[i].id;
											break;
										}
									}
								};
								this.$data.orderFromData.outOrderDate = new Date(); //出单日期默认今天
								this.$data.containSure = true;
								//出单按钮等待框消失
								this.$data.fullscreenloading = false;
								this.$data.orderShow = true; //出单弹出框
								this.$data.continuous = 'false';
								this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
								this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
								var id = this.$data.checkData.insuranceCompanyId || this.$data.multipleSelection[0].insuranceCompanyId;
								this.queryInsuranceNumber(this.$data.orderFromData.outOrderDate, id); //查询商业险合同号
							}
							this.$data.orderFromData.payPeople = this.$data.multipleSelection[0].insured;
							this.queryCommission(this.$data.orderFromData.outOrderDate, qId);
							this.queryPresent(carId, qId); //查询添加的赠品信息
						}
						this.$data.fullscreenLoading = false;
					}, (response) => {
						debugger;
					});
				} else {
					var qId = this.$data.checkData.qid;
					var carId = this.$data.checkData.id;
					this.$data.presentQId = qId;
					this.$data.presentCarId = carId;
					this.$data.insuranceCompanyId = this.$data.checkData.insuranceCompanyId;
					//查询保险单
					this.$http.get(this.API_ROOT + '/insurance/Order/info', {
						params: {
							qId: qId,
							carId: carId
						}
					}).then((response) => {
						debugger;
						if(response.data.data.syItems == 0 && response.data.data.jqItems == 0) {
							this.$message.error("还未录入保险项目，请先进行设置录入");
							return false;
						} else {
							this.$data.orderFromData = Object.assign(this.$data.orderFromData, this.$data.emptyOrderFromData);
							if(response.data.data.syItems > 0) {
								this.$data.syItemsShow = true;
								this.$data.orderFromData.commercialinsuranceStartDate = new Date(this.$data.checkData.insuranceStartDate);
								this.$data.orderFromData.commercialinsuranceStopDate = new Date(this.$data.checkData.insuranceStopDate);
							}
							if(response.data.data.jqItems > 0) {
								this.$data.jqItemsShow = true;
								this.$data.orderFromData.compulsoryStartDate = new Date(this.$data.checkData.insuranceStartDate);
								this.$data.orderFromData.compulsoryStopDate = new Date(this.$data.checkData.insuranceStopDate);
							}
							if(response.data.data.id) {
								//this.$data.orderInfoData=response.data.data;
								this.$data.orderFromData = response.data.data;
								this.$data.orderFromData.compulsoryNum = response.data.data.compulsoryNum;
								this.$data.orderFromData.commercialinsuranceNum = response.data.data.commercialinsuranceNum;
								//出单按钮等待框消失
								this.$data.fullscreenloading = false;
								this.$data.orderShow = true; //出单弹出框
								if(this.$data.orderFromData.continuous) {
									this.$data.continuous = this.$data.orderFromData.continuous;
								} else {
									this.$data.continuous = 'false';
								}
								this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
								this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
								this.$data.containSure = false;
							} else {
								if(this.$data.checkData.insureType == 'sb') {
									for(var i = 0; i < this.$data.insTypeConvertData.length; i++) {
										if(this.$data.insTypeConvertData[i].label == '新保') {
											this.$data.orderFromData.baseType = this.$data.insTypeConvertData[i].id;
											break;
										}
									}
								};
								this.$data.orderFromData.outOrderDate = new Date(); //出单日期默认今天
								this.$data.containSure = true;
								//出单按钮等待框消失
								this.$data.fullscreenloading = false;
								this.$data.orderShow = true; //出单弹出框
								this.$data.continuous = 'false';
								this.$data.orderFromData.commissionSy = ""; //出单界面弹出清空商业险佣金
								this.$data.orderFromData.commissionJq = ""; //出单界面弹出清空交强险佣金
								var id = this.$data.checkData.insuranceCompanyId || this.$data.checkData.insuranceCompanyId;
								this.queryInsuranceNumber(this.$data.orderFromData.outOrderDate, id, this.$data.checkData.storeCode); //查询商业险合同号
							}
							this.$data.orderFromData.payPeople = this.$data.checkData.insured;
							this.queryCommission(this.$data.orderFromData.outOrderDate, qId, this.$data.checkData.storeCode);
							this.queryPresent(carId, qId); //查询添加的赠品信息
						}
						this.$data.fullscreenLoading = false;
					}, (response) => {
						debugger;
					});
				}

			},
			//出单日期变化的时候，调用请求佣金，根据出单日期佣金变化
			outDateChange: function() {
				this.$data.orderFromData.outOrderDate = this.moment(this.$data.orderFromData.outOrderDate).format("YYYY-MM-DD");
				var qId = this.$data.presentQId;
				var now = this.moment().format("YYYY-MM-DD");
				if(this.$data.orderFromData.outOrderDate > now) {
					this.$message.error("出单日期不可以在未来");
					this.$data.orderFromData.outOrderDate = now;
				}
				this.queryCommission(this.$data.orderFromData.outOrderDate, qId, this.$data.checkData.storeCode);
			},
			//保存报价单维护客户以及车辆信息
			saveCusInfo: function() {
				this.$http.post(this.API_ROOT + '/insurance/car/save', this.$data.infoData)
					.then(resp => {
						debugger;
						if(resp.data.success) {
							this.$message(resp.data.msg);
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {

					});
			},
			//确认价格之后再保存。
			comFormShowsSure: function() {
				if(this.$data.infoData.source == '0' && this.isCardNo(this.$data.infoData.insuredIdNumber) == false) {
					this.$message.error("请填写正确的身份证号！")
				} else {
					this.$refs.comForm.validate(function(valid, $event) {
						// 验证通过
						if(valid) {
							debugger;
							var sum = 0;
							for(var i = 0; i < this.$data.intem.length; i++) {
								//勾选保险项目为填写保费 时
								if(this.$data.intem[i].starts == true && this.$data.intem[i].price == "") {
									this.$message.error(this.$data.intem[i].name + "未填写保费!");
									return false;
								};
								//三者保额验证
								if(i == 4 && this.$data.intem[i].starts == true && this.$data.intem[i].limit == "") {
									this.$message.error(this.$data.intem[i].name + "未填写保额!");
									return false;
								}
								//车上司机保额验证
								if(i == 8 && this.$data.intem[i].starts == true && this.$data.intem[i].limit == "") {
									this.$message.error(this.$data.intem[i].name + "未填写保额!");
									return false;
								}
								//车上乘客保额验证
								if(i == 9 && this.$data.intem[i].starts == true && this.$data.intem[i].limit == "") {
									this.$message.error(this.$data.intem[i].name + "未填写保额!");
									return false;
								}
								if(this.$data.intem[i].starts == false) {
									sum = sum + 0;
								} else {
									sum = sum + 1;
								}

							}
							if(sum == 0) {
								this.$message.error("请至少选择一条保险项目,并且填写保费");
								return false;
							} else {
								this.sureShow = true;
								this.saveCusInfo(); //保存车主以及车辆信息
							}
						} else {
							this.$message.error("请完善客户信息！");
							return false
						}
					}.bind(this))
				}
			},
			//身份验证
			isCardNo: function(card) {
				debugger;
				// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X  
				var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x|Y|y|)$)/;
				if(reg.test(card) === false) {
					return false;
				} else {
					return true;
				}
			},
			//保存报价单（点保存的时候要询问是否出单）
			saveEdit: function() {
				debugger;
				this.$data.fullscreenloading = true;
				var syPrice = Number(this.$data.syxbj).toFixed(2);
				this.sureShow = false;
				if(syPrice == 0) {
					this.yujingSave();
				} else {
					//报价检测
					//					this.$http.get(this.API_ROOT + '/insurance/Quotation/checkWarning', {
					//						params: {
					//							carId: this.$data.checkData.id,
					//							syPrice: syPrice,
					//						}
					//					}).then(resp => {
					//						debugger;
					//						if(resp.data.success) {	
					this.yujingSave();
					//						} else {
					//							this.$data.yujingShow = true;
					//							this.$data.yujingMsg = resp.data.msg;
					//						}
					//					}, resp => {});
				}

			},
			yujingSave: function() {
				//保存保险项目
				var items = [];
				var y = 0;
				for(var i = 0; i < this.$data.intem.length; i++) {
					debugger;
					if(this.$data.intem[i].starts == true) {
						items[y] = this.$data.intem[i];
						y++;
					}
				};
				debugger;
				this.$http.post(this.API_ROOT + '/insurance/QuotationItem/save', items, {
					params: {
						QuotationId: this.$data.checkData.qid
					}
				}).then(resp => {

					if(resp.data.success) {
						this.$data.infoData.insuranceStartDate = this.moment(this.$data.infoData.insuranceStartDate).format("YYYY-MM-DD");
						this.$data.infoData.insuranceStopDate = this.moment(this.$data.infoData.insuranceStopDate).format("YYYY-MM-DD");
						this.$http.post(this.API_ROOT + '/insurance/Quotation/update', this.$data.infoData, { //更新报价单
							params: {
								id: this.$data.checkData.qid
							}
						}).then(resp => {
							debugger;
							this.$data.fullscreenloading = false;
							if(resp.data.success) {
								//								this.$data.yujingShow = false;
								this.$data.comFormShows = false;
								if(this.$data.outStatus == true) {
									this.$data.fullscreenloading = true;
									this.outOrdersave();
								}
							} else {
								this.$message.error(resp.data.msg);
								//								this.$data.yujingShow = false;
								this.$data.comFormShows = false;
							}
						}, resp => {});
					} else {
						//debugger;
						this.$data.fullscreenloading = false;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});

			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//查询公司
			companyQuery: function() {
				debugger;
				this.$data.condition.startDate = this.momentFu(this.$data.condition.startDate);
				this.$data.condition.stopDate = this.momentFu(this.$data.condition.stopDate);
				this.$http.post(this.API_ROOT + '/insurance/Quotation/page', this.$data.condition, {
					params: {
						limit: this.page.pageSize,
						start: this.$data.CurentPage
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableData = resp.data;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//维护报价单信息
			/*
			 1、显示新增窗口
			 2、获取该客户的信息
			 3、加载报价单信息
			 * */
			info: function() {
				debugger;
				//显示窗口
				this.$data.addOrEdit = false;
				this.$data.outStatus = false;
				if(this.$data.multipleSelection.length == 1) {
					if(this.$data.multipleSelection[0].status == 2) {
						this.$message.error("该报价单已出单不能进行编辑");
					} else {
						this.$data.checkData = this.$data.multipleSelection[0];

						//				this.$data.intem[0].starts=true;
						this.$data.comFormShows = true;
						this.intemInfo(); //请求已经选中的报价单项目
						//获取选择的对象

						//请求车辆及客户信息系
						this.$http.get(this.API_ROOT + '/insurance/car/carInfo', {
							params: {
								id: this.$data.checkData.id
							}
						}).then((response) => {
							debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
							//被保险人类型若为"",默认为"0"：个人
							if(this.$data.infoData.source == "" || this.$data.infoData.source == null || this.$data.infoData.source == "null") {
								this.$data.infoData.source = "0";
							};
							this.$data.infoData.insuranceStartDate = this.$data.multipleSelection[0].insuranceStartDate;
							this.$data.infoData.insuranceStopDate = this.$data.multipleSelection[0].insuranceStopDate;
							//						this.$data.infoData.insuredIdNumber = response.data.data.insuredIDNumber;
							this.$data.orderFromData.payPeople = response.data.data.insured;
							if(this.$data.checkData.commercialinsuranceDiscount) {
								this.$data.infoData.commercialinsuranceDiscount = this.$data.checkData.commercialinsuranceDiscount;
							} else {
								this.$data.infoData.commercialinsuranceDiscount = "";
							}
							if(this.$data.checkData.compulsoryDiscount) {
								this.$data.infoData.coupulsoryDiscount = this.$data.checkData.compulsoryDiscount;
							} else {
								this.$data.infoData.coupulsoryDiscount = "";
							}

						}, (response) => {
							debugger;
						});
						//请求保险项目
						this.$http.get(this.API_ROOT + '/insurance/QuotationItem/QuotationItemList', {
							params: {
								id: this.$data.checkData.qid
							}
						}).then((response) => {
							debugger;
							this.$data.infoData = Object.assign(this.$data.infoData, response.data[0]);
						}, (response) => {
							debugger;
						});
					}
				} else {
					this.$message.error("请选择一条数据！");
				}
			},
			//保存
			save: function() {
				if(this.$data.QuotationFrom.paramQuotation.insureType == '') {
					this.$message.error("请选择投保类别");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.insuranceStartDate == '') {
					this.$message.error("请选择投保起始日");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.insuranceCompanyId == '') {
					this.$message.error("请选择保险公司");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.storeParea == '') {
					this.$message.error("请选择一级区域");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.storeArea == '') {
					this.$message.error("请选择二级区域");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.storeChanel == '') {
					this.$message.error("请选择渠道");
					return false;
				} else if(this.$data.QuotationFrom.paramQuotation.storeName == '') {
					this.$message.error("请选择门店");
					return false;
				} else {
					this.$data.fullscreenloading = true;
					//找到一级区域name
					for(var i = 0; i < this.$data.storePareaCombo.length; i++) {
						if(this.$data.QuotationFrom.paramQuotation.storePareaCode == this.$data.storePareaCombo[i].value) {
							this.$data.QuotationFrom.paramQuotation.storeParea = this.$data.storePareaCombo[i].label;
							break;
						}
					}
					//找到二级区域name
					for(var i = 0; i < this.$data.storeAreaCombo.length; i++) {
						if(this.$data.QuotationFrom.paramQuotation.storeAreaCode == this.$data.storeAreaCombo[i].value) {
							this.$data.QuotationFrom.paramQuotation.storeArea = this.$data.storePareaCombo[i].label;
							break;
						}
					}
					//找到门店name
					for(var i = 0; i < this.$data.storeNameCombo.length; i++) {
						if(this.$data.QuotationFrom.paramQuotation.storeCode == this.$data.storeNameCombo[i].value) {
							this.$data.QuotationFrom.paramQuotation.storeName = this.$data.storeNameCombo[i].label;
							break;
						}
					}
					this.$data.QuotationFrom.paramQuotation.insuranceStartDate = this.moment(this.$data.QuotationFrom.paramQuotation.insuranceStartDate).format("YYYY-MM-DD");
					this.$http.post(this.API_ROOT + '/insurance/Quotation/save', this.$data.QuotationFrom)
						.then(resp => {
							this.$data.fullscreenloading = false;
							if(resp.data.success) {
								debugger;
								this.companyQuery();
								this.$data.checkData = resp.data.data;
								this.$data.comFormShow = false;
								this.$data.checkData = resp.data.data;
								this.newinfo();
								this.$data.auditShow = true;

							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {});
				}
			},
			lastMessage: function(type) {
				//debugger;
				this.$http.get(this.API_ROOT + '/insurance/QuotationItem/QuotationItemList/lately', {
					params: {
						carId: this.$data.checkData.id,
						key: type
					}
				}).then((response) => {
					debugger;
					for(var j = 0; j < this.$data.intem.length; j++) {
						this.$data.intem[j].starts = false;
						this.$data.intem[j].limit = "";
						this.$data.intem[j].price = "";
					}

					var respData = response.data
					for(var i = 0; i < respData.length; i++) {
						for(var j = 0; j < this.$data.intem.length; j++) {
							if(this.$data.intem[j].id == respData[i].itemId) {
								this.$data.intem[j].starts = true;
								this.$data.intem[j].limit = respData[i].itemLimit;
								this.$data.intem[j].price = respData[i].itemPrice;
								break;
							}
						}
					}
					this.sumPrice();
					this.$data.auditShow = false;
				}, (response) => {
					debugger;
				});
			},
			newinfo: function() {
				debugger;
				//显示窗口
				this.$data.outStatus = false;
				this.$data.comFormShows = true;
				this.intemInfo(); //请求已经选中的报价单项目
				this.itmeQuerySy();
				this.itmeQueryJq();
				//请求车辆及客户信息系
				this.$http.get(this.API_ROOT + '/insurance/car/carInfo', {
					params: {
						id: this.$data.checkData.id
					}
				}).then((response) => {
					debugger;
					this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
					//被保险人类型若为"",默认为"0"：个人
					if(this.$data.infoData.source == "" || this.$data.infoData.source == null || this.$data.infoData.source == "null") {
						this.$data.infoData.source = "0";
					};
					this.$data.infoData.insuranceStartDate = this.$data.checkData.insuranceStartDate;
					this.$data.infoData.insuranceStopDate = this.$data.checkData.insuranceStopDate;
					//						this.$data.infoData.insuredIdNumber = response.data.data.insuredIDNumber;
					this.$data.orderFromData.payPeople = response.data.data.insured;
				}, (response) => {
					debugger;
				});
				//				//请求保险项目
				//				this.$http.get(this.API_ROOT + '/insurance/QuotationItem/QuotationItemList', {
				//					params: {
				//						id: this.$data.checkData.id
				//					}
				//				}).then((response) => {
				//					debugger;
				//					this.$data.infoData = Object.assign(this.$data.infoData, response.data[0]);
				//				}, (response) => {
				//					debugger;
				//				});
			},
			deletee: function() {
				if(this.$data.multipleSelection.length == 1) {
					this.$confirm('此操作将永久删除保险单和优惠券信息, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.$http({
							method: 'POST',
							url: this.API_ROOT + '/insurance/Quotation/del',
							params: {
								id: this.$data.multipleSelection[0].qid,
							}
						}).then(function(resp) {
							debugger;
							this.$message(resp.data.msg);
							this.companyQuery();
						}, function(error) {})
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消'
						});
					});

				} else {
					this.$message.error("请选择一条数据");
				}
			},
			//打开搜索的车型选择
			chooseSearchModel: function() {
				this.$data.searchCarShow = true;
			},
			//资源过滤
			filterNode: function(value, data, node) {
				if(!value) return true;
				return data.label.indexOf(value) !== -1;
			},
			//查询搜索的参数树
			querySearchTree: function() {
				//获取资源树
				debugger;
				this.$http.get(this.API_ROOT + '/base/car/pages', {
					params: {
						type: '0'
					}
				}).then((response) => {
					this.$data.SearchTreeData = response.data;
				}, (response) => {});
			},
			//点击搜索的资源树节点
			searchNodeClick(data) { //TODO
				debugger;
				this.$data.infoData.carValue = '';
				this.$data.infoData.carLevel = '';
				//				
				this.$data.searhcarType = data.type;
				this.$data.searchdatalabel = data.label;
				this.$data.searchdatavale = data.value;
				this.$data.searchdataNumber = data.number;
				this.$data.infoData.carLevel = data.type;
				this.$data.infoData.carValue = data.value;

			},
			//搜索确认车型
			serchSaveCar: function() {
				debugger;
				if(this.$data.searhcarType == 0) {
					this.$message.error("请不要选择品牌！");
				} else {
					this.$data.infoData.carModel = this.$data.searchdatalabel;
					this.$data.infoData.label = this.$data.searchdataNumber;
					this.$data.customerData.carLevel = this.$data.searhcarType;
					this.$data.customerData.carModel = this.$data.searchdatalabel;
					this.$data.customerData.label = this.$data.searchdataNumber
					this.$data.searchCarShow = false;
				}
			},
			//获取市场活动
			queryActivity: function() {
				this.$http.get(this.API_ROOT + '/crm/activity/activityIng', {
					params: {}
				}).then((response) => {
					debugger;
					this.$data.activities = response.data.data;
					//this.$data.infoData = Object.assign(this.$data.infoData, response.data.data);
				}, (response) => {
					debugger;
				});
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				this.companyQuery();
			},
			//创建日期格式转换
			createDate: function(row, column) {
				if(row.time == "" || row.time == null) return "";
				return moment(Number(row.time)).format("YYYY-MM-DD");
			},
			//使用状态解析
			levelCov: function(row, column) {
				return row.status == 1 ? "已打印" : "已使用";
			},
			//有效期解析
			timeFormates: function(row, column) {
				if(row.youxiaoqi == "" || row.youxiaoqi == null) return "";
				return this.moment(Number(row.youxiaoqi)).format("YYYY-MM-DD");
			},
			//获取二级区域
			getStoreAreaCombo: function() {
				this.$http.get(this.API_ROOT + '/base/dict/combo', {
					params: {
						group: this.$data.QuotationFrom.paramQuotation.storePareaCode
					}
				}).then((response) => {
					this.$data.storeAreaCombo = response.data;
				}, (response) => {});
			},
			//获取门店
			getStoreNameCombo: function() {
				this.$http.get(this.API_ROOT + '/rbac/dept/deptStoreArea', {
					params: {
						storeParea: this.$data.QuotationFrom.paramQuotation.storePareaCode,
						storeArea: this.$data.QuotationFrom.paramQuotation.storeAreaCode,
						type: 1,
					}
				}).then((response) => {
					this.$data.storeNameCombo = response.data.dataList;
				}, (response) => {});
			},
			getinsuranceCompany: function() {
				this.$http.get(this.API_ROOT + '/insurance/combo', {
					params: {
						storeCode: this.$data.QuotationFrom.paramQuotation.storeCode
					}
				}).then((response) => {
					// success callback
					this.$data.companyCombo = response.data;
				}, (response) => {
					// error callback
				});
			},
		},
		//表单创建时执行
		created: function() {
			this.companyQuery();
			this.querySearchTree();
			//			this.queryPresent(this.$data.checkData.id,this.$data.checkData.qid); //查询添加的赠品信息
			//获取商业险下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "syItem"
				}
			}).then((response) => {
				// success callback
				this.$data.syxCombo = response.data;
			}, (response) => {
				// error callback
			});
			//获取交强险下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "jqItem"
				}
			}).then((response) => {
				// success callback
				this.$data.jqxCombo = response.data;
			}, (response) => {
				// error callback
			});
			//获取基盘类别
			this.$http.get(this.API_ROOT + '/base/dict/combo/insurance', {
				params: {
					group: "insuranceType"
				}
			}).then((response) => {
				debugger;
				this.$data.insTypeConvertData = response.data;
			}, (response) => {});
			//获取销售人员
			this.$http.get(this.API_ROOT + '/rbac/user/allUsers', {
				params: {}
			}).then((response) => {
				this.$data.salePeopleCombo = response.data.dataList;
			}, (response) => {});
			//获取区域下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "area"
				}
			}).then((response) => {
				this.$data.storePareaCombo = response.data;
			}, (response) => {});
		}
	}
</script>
<style>
	.box-carda {
		width: 100%;
		height: 300px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-card {
		width: 100%;
		height: 250px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-cards {
		width: 100%;
		height: 200px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.table_input {
		border-style: none;
		outline: medium;
		border-bottom: 1px solid #20a0ff!important;
		width: 100%;
		height: 100%;
	}
</style>